/* ==========================================================================
   NexaChat WordPress Site Simulator & Interactive AI Chat Widget Styles
   ========================================================================== */

:root {
  --font-sans: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --brand-primary-gradient: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #4F46E5 100%);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* WordPress Simulated Site Container */
.wp-simulator-wrapper {
  background: #FAFAFA;
  color: #1F2937;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
  min-height: 850px;
}

/* WP Mock Browser Chrome */
.wp-browser-bar {
  background: #E5E7EB;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #D1D5DB;
}

.browser-dots {
  display: flex;
  gap: 6px;
}

.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #EF4444; }
.dot-yellow { background: #F59E0B; }
.dot-green { background: #10B981; }

.wp-url-pill {
  flex: 1;
  background: #FFFFFF;
  border-radius: var(--radius-full);
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  color: #4B5563;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* WP Site Navigation */
.wp-site-header {
  background: #FFFFFF;
  border-bottom: 2px solid #F97316;
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wp-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: #EA580C;
}

.wp-nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
}

.wp-nav-links a:hover {
  color: #EA580C;
}

/* WP Hero Banner */
.wp-hero-banner {
  height: 380px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 2.5rem;
}

.wp-hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
}

.wp-hero-content {
  position: relative;
  z-index: 2;
  color: #FFFFFF;
  max-width: 800px;
}

.wp-badge {
  background: #EA580C;
  color: #FFFFFF;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.wp-hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.wp-hero-meta {
  font-size: 0.9rem;
  opacity: 0.9;
  display: flex;
  gap: 1.5rem;
}

/* WP Content Body */
.wp-main-article {
  padding: 2.5rem;
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.8;
  font-size: 1.05rem;
  color: #374151;
}

.wp-main-article p {
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Embeddable Floating AI Chat Widget
   ========================================================================== */
.nexa-widget-container {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  font-family: var(--font-sans);
}

/* Floating Launcher Button */
.nexa-launcher-btn,
#widget-launcher-btn {
  width: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  height: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  border-radius: 50% !important;
  background: var(--theme-brand-gradient, linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%));
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  border: 2px solid #FFFFFF !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  outline: none !important;
  overflow: visible !important;
  flex-shrink: 0 !important;
  line-height: normal !important;
}

.nexa-launcher-btn:hover,
#widget-launcher-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(249, 115, 22, 0.6);
}

.nexa-launcher-avatar,
#widget-launcher-avatar-img,
.nexa-launcher-btn img,
#widget-launcher-btn img {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  object-fit: contain !important;
  display: block !important;
  flex: 0 0 48px !important;
  flex-shrink: 0 !important;
  margin: 0 auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  border: none !important;
  pointer-events: none !important;
  transform: none !important;
}

.nexa-launcher-badge {
  position: absolute !important;
  top: -6px !important;
  right: -8px !important;
  background: #10B981 !important;
  color: #FFFFFF !important;
  border: 2px solid #FFFFFF !important;
  border-radius: var(--radius-full) !important;
  font-size: 0.62rem !important;
  font-weight: 700 !important;
  padding: 2px 7px !important;
  line-height: 1.15 !important;
  letter-spacing: 0.02em !important;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.4) !important;
  pointer-events: none !important;
  z-index: 5 !important;
  white-space: nowrap !important;
}

/* Callout Tooltip next to launcher */
.nexa-launcher-callout {
  position: absolute;
  right: 76px;
  bottom: 12px;
  background: #FFFFFF;
  color: #1F2937;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  animation: callout-float 3s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nexa-launcher-callout::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent #FFFFFF;
}

@keyframes callout-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Theme Customizations */
.theme-tac {
  --theme-brand-gradient: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #4F46E5 100%);
  --theme-brand-color: #2563EB;
  --theme-brand-shadow: rgba(37, 99, 235, 0.45);
  --theme-bubble-user: #2563EB;
}

/* ==========================================================================
   Full Screen Dark Backdrop Dimmer (Requirement 1)
   ========================================================================== */
#widget-backdrop-dimmer,
.nexa-backdrop-dimmer {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(10, 15, 29, 0.78) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  z-index: 2147483640 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
  pointer-events: none !important;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.32s !important;
  margin: 0 !important;
  padding: 0 !important;
}

#widget-backdrop-dimmer.active,
.nexa-backdrop-dimmer.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Simulator Embedded Mode for Backdrop */
.wp-simulator-wrapper #widget-backdrop-dimmer,
.wp-simulator-wrapper .nexa-backdrop-dimmer {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit !important;
  z-index: 80 !important;
}

/* ==========================================================================
   Interactive Chat Stage (Holds 3D Mascot + Chat Column)
   ========================================================================== */
#widget-chat-stage,
.nexa-chat-stage {
  position: fixed !important;
  bottom: 24px !important;
  right: 28px !important;
  left: auto !important; /* CRITICAL: Prevents WordPress/Elementor from setting left: 0 */
  top: auto !important;  /* CRITICAL: Prevents WordPress/Elementor from setting top: 0 */
  display: none !important; /* CRITICAL: Default hidden when closed! */
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  gap: 16px !important;
  z-index: 2147483647 !important; /* Highest possible 32-bit z-index */
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(20px) scale(0.97) !important;
  transform-origin: bottom right !important;
  pointer-events: none !important;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  line-height: normal !important;
  box-sizing: border-box !important;
  max-width: calc(100vw - 32px) !important;
  max-height: calc(100vh - 32px) !important;
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
}

#widget-chat-stage *,
#widget-chat-stage *::before,
#widget-chat-stage *::after,
.nexa-chat-stage *,
.nexa-chat-stage *::before,
.nexa-chat-stage *::after {
  box-sizing: border-box !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

#widget-chat-stage p,
.nexa-chat-stage p {
  margin: 0 0 0.5rem 0 !important;
  padding: 0 !important;
}
#widget-chat-stage p:last-child,
.nexa-chat-stage p:last-child {
  margin-bottom: 0 !important;
}

#widget-chat-stage form,
.nexa-chat-stage form {
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
}

#widget-chat-stage input,
.nexa-chat-stage input {
  box-shadow: none !important;
  outline: none !important;
}

#widget-chat-stage button,
.nexa-chat-stage button {
  box-shadow: none !important;
  outline: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

#widget-chat-stage.open,
#widget-chat-stage.nexa-stage-open,
.nexa-chat-stage.open,
.nexa-chat-stage.nexa-stage-open {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  position: fixed !important;
  bottom: 24px !important;
  right: 28px !important;
  left: auto !important;
  top: auto !important;
  z-index: 2147483647 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
}

/* Inside Simulator Container */
.wp-simulator-wrapper #widget-chat-stage,
.wp-simulator-wrapper .nexa-chat-stage {
  position: absolute !important;
  bottom: 20px !important;
  right: 24px !important;
  z-index: 95 !important;
}

/* 3D Mascot Character Wrapper */
#widget-mascot-wrapper,
.nexa-mascot-wrapper {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  position: relative !important;
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: 220px !important;
  user-select: none !important;
  pointer-events: none !important;
  animation: nexa-mascot-float 4.5s ease-in-out infinite !important;
  margin: 0 !important;
  padding: 0 !important;
}

#widget-mascot-img,
.nexa-mascot-img {
  width: var(--nexa-mascot-size, 200px) !important;
  max-width: var(--nexa-mascot-size, 200px) !important;
  height: auto !important;
  max-height: min(520px, calc(100vh - 120px)) !important;
  object-fit: contain !important;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.45)) !important;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s ease !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

@keyframes nexa-mascot-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Chat Column (Right side: Main Window + Floating Pill Input) */
#widget-chat-column,
.nexa-chat-column {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: var(--nexa-chat-width, 380px) !important;
  max-width: calc(100vw - 32px) !important;
  min-width: 280px !important;
  flex: 0 0 var(--nexa-chat-width, 380px) !important;
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  height: auto !important;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), flex-basis 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Main Chat Window Box */
#widget-chat-window,
.nexa-chat-window,
.nexa-chat-column .nexa-chat-window {
  position: relative !important;
  width: 100% !important;
  height: var(--nexa-chat-height, 520px) !important;
  max-height: calc(100vh - 120px) !important;
  min-height: 340px !important;
  background: #FFFFFF !important;
  border-radius: 24px !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Expanded View Override (Requirement: Expand Chatbot Window) */
.nexa-chat-stage.is-expanded #widget-chat-column,
#widget-chat-stage.is-expanded #widget-chat-column {
  width: min(480px, calc(100vw - 32px)) !important;
  flex: 0 0 min(480px, calc(100vw - 32px)) !important;
}

.nexa-chat-stage.is-expanded #widget-chat-window,
#widget-chat-stage.is-expanded #widget-chat-window {
  height: min(660px, calc(100vh - 80px)) !important;
}

/* Chat Window Header (Dedicated to Chatbot Brand) */
.nexa-chat-header,
#widget-chat-window .nexa-chat-header {
  background: var(--theme-brand-gradient, linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%)) !important;
  color: #FFFFFF !important;
  padding: 10px 16px !important;
  min-height: 56px !important;
  max-height: 60px !important;
  height: 58px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
  border-top-left-radius: 24px !important;
  border-top-right-radius: 24px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

.nexa-chat-header-info,
#widget-chat-window .nexa-chat-header-info {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

.header-avatar,
.nexa-chat-header-info .header-avatar,
#widget-header-avatar-img,
#widget-chat-window img.header-avatar {
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  object-fit: contain !important;
  aspect-ratio: 1 / 1 !important;
  display: block !important;
  flex: 0 0 38px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.header-text-details {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-align: left !important;
  margin: 0 !important;
  padding: 0 !important;
}

.header-title,
#widget-chat-window .header-title {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: #FFFFFF !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.header-status,
#widget-chat-window .header-status {
  font-size: 0.72rem !important;
  color: rgba(255, 255, 255, 0.9) !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.status-dot-green {
  width: 7px !important;
  min-width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #34D399 !important;
  display: inline-block !important;
  box-shadow: 0 0 6px #34D399 !important;
  flex-shrink: 0 !important;
}

.header-controls,
#widget-chat-window .header-controls {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

.header-btn,
.nexa-chat-header button.header-btn,
#widget-chat-window .nexa-chat-header button.header-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #FFFFFF !important;
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  outline: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.header-btn:hover,
.nexa-chat-header button.header-btn:hover,
#widget-chat-window .nexa-chat-header button.header-btn:hover {
  background: rgba(255, 255, 255, 0.35) !important;
  transform: scale(1.05) !important;
}

/* Messages Area - Guaranteed Smooth Scrolling */
#chat-messages-feed,
.nexa-messages-container {
  flex: 1 1 0px !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: 100% !important;
  padding: 1.15rem !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  overscroll-behavior: contain !important;
  background: #F8FAFC !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.85rem !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  width: 100% !important;
}

#chat-messages-feed::-webkit-scrollbar,
.nexa-messages-container::-webkit-scrollbar {
  width: 6px !important;
}
#chat-messages-feed::-webkit-scrollbar-track,
.nexa-messages-container::-webkit-scrollbar-track {
  background: transparent !important;
}
#chat-messages-feed::-webkit-scrollbar-thumb,
.nexa-messages-container::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5) !important;
  border-radius: 9999px !important;
}
#chat-messages-feed::-webkit-scrollbar-thumb:hover,
.nexa-messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.8) !important;
}

/* Message Bubbles */
#widget-chat-stage .msg-row,
.msg-row {
  display: flex !important;
  gap: 0.6rem !important;
  max-width: 90% !important;
  animation: msg-fade-in 0.25s ease !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
}

@keyframes msg-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

#widget-chat-stage .msg-row.user,
.msg-row.user {
  margin-left: auto !important;
  flex-direction: row-reverse !important;
}

#widget-chat-stage .msg-avatar,
.msg-avatar {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  border-radius: 50% !important;
  object-fit: contain !important;
  aspect-ratio: 1 / 1 !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

#widget-chat-stage .msg-bubble,
.msg-bubble {
  padding: 0.75rem 0.95rem !important;
  border-radius: 12px !important;
  font-size: 0.88rem !important;
  line-height: 1.5 !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

#widget-chat-stage .msg-row.bot .msg-bubble,
.msg-row.bot .msg-bubble {
  background: #FFFFFF !important;
  color: #1F2937 !important;
  border: 1px solid #E5E7EB !important;
  border-top-left-radius: 2px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

#widget-chat-stage .msg-row.user .msg-bubble,
.msg-row.user .msg-bubble {
  background: #EA580C !important;
  color: #FFFFFF !important;
  border-top-right-radius: 2px !important;
}

/* Grounded Citation Card */
.citation-card {
  margin-top: 0.75rem;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
}

.citation-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #15803D;
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.citation-link {
  color: #047857;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: block;
  word-break: break-all;
}

.citation-link:hover {
  color: #065F46;
}

/* Inline Chat Links inside Message Bubbles */
.chat-inline-link {
  color: #2563EB;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
  transition: color 0.15s ease;
}

.chat-inline-link:hover {
  color: #1D4ED8;
  text-decoration: underline;
}

.msg-row.user .chat-inline-link {
  color: #DBEAFE;
}

.msg-row.user .chat-inline-link:hover {
  color: #FFFFFF;
}

/* Interactive Conversational Review Card */
.review-prompt-card {
  margin-top: 0.75rem;
  background: #FFF7ED;
  border: 1px solid #FFEDD5;
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.review-card-title {
  font-weight: 700;
  color: #C2410C;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.star-rating {
  display: flex;
  gap: 4px;
  color: #F59E0B;
  font-size: 1.1rem;
  cursor: pointer;
  margin-bottom: 0.6rem;
}

.review-textarea {
  width: 100%;
  border: 1px solid #FED7AA;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-size: 0.8rem;
  background: #FFFFFF;
  resize: none;
  height: 55px;
  margin-bottom: 0.5rem;
}

.consent-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #6B7280;
  margin-bottom: 0.6rem;
}

.submit-review-btn {
  background: #EA580C;
  color: #FFFFFF;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.submit-review-btn:hover {
  background: #C2410C;
}

/* Suggestion Quick Chips */
#widget-chat-stage .nexa-quick-chips,
.nexa-quick-chips,
.quick-chips-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.35rem !important;
  padding: 0.5rem 0.85rem !important;
  background: #F1F5F9 !important;
  border-top: 1px solid #E2E8F0 !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  max-height: 85px !important;
  overflow-y: auto !important;
  margin: 0 !important;
}

#widget-chat-stage .chip-btn,
.nexa-quick-chips .chip-btn,
.quick-chips-row .chip-btn,
.chip-btn {
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
  border-radius: 9999px !important;
  padding: 4px 11px !important;
  font-size: 0.74rem !important;
  color: #334155 !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  line-height: 1.4 !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
  transition: all 0.2s ease !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  text-decoration: none !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

#widget-chat-stage .chip-btn:hover,
.chip-btn:hover {
  background: #EFF6FF !important;
  border-color: #3B82F6 !important;
  color: #1D4ED8 !important;
}

/* Separate Pill Input Bar (Mockup Style) */
#widget-chat-stage .nexa-chat-input-pill-area,
.nexa-chat-input-pill-area {
  width: 100% !important;
  height: 54px !important;
  min-height: 54px !important;
  max-height: 54px !important;
  background: #FFFFFF !important;
  border-radius: 9999px !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
  display: flex !important;
  align-items: center !important;
  padding: 6px 8px 6px 18px !important;
  gap: 10px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  border: none !important;
  flex-shrink: 0 !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease !important;
}

#widget-chat-stage .nexa-chat-input-pill-area:focus-within,
.nexa-chat-input-pill-area:focus-within {
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--theme-brand-color, #2563EB) !important;
  transform: translateY(-1px) !important;
}

#widget-chat-stage .chat-input-pill,
.chat-input-pill {
  flex: 1 1 auto !important;
  width: 0 !important;
  min-width: 0 !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 0.92rem !important;
  color: #1F2937 !important;
  padding: 0 !important;
  margin: 0 !important;
  height: 38px !important;
  box-shadow: none !important;
  line-height: normal !important;
}

#widget-chat-stage .chat-input-pill::placeholder,
.chat-input-pill::placeholder {
  color: #9CA3AF !important;
  font-size: 0.88rem !important;
  opacity: 1 !important;
}

#widget-chat-stage .chat-send-btn-pill,
.chat-send-btn-pill {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 50% !important;
  background: var(--theme-brand-gradient, linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%)) !important;
  color: #FFFFFF !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  flex-shrink: 0 !important;
  box-shadow: 0 4px 14px var(--theme-brand-shadow, rgba(37, 99, 235, 0.4)) !important;
  margin: 0 !important;
  padding: 0 !important;
}

#widget-chat-stage .chat-send-btn-pill:hover,
.chat-send-btn-pill:hover {
  transform: scale(1.08) !important;
}

#widget-chat-stage .chat-send-btn-pill svg,
.chat-send-btn-pill svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  stroke: #FFFFFF !important;
}

/* User Message bubble theme colors */
.theme-tac .msg-row.user .msg-bubble {
  background: var(--theme-bubble-user, #2563EB) !important;
  color: #FFFFFF !important;
}

.theme-tac .nexa-launcher-btn,
.theme-tac #widget-launcher-btn {
  background: var(--theme-brand-gradient, linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%)) !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
}

.theme-tac .nexa-launcher-btn:hover,
.theme-tac #widget-launcher-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.65) !important;
}

.nexa-launcher-btn.is-white-bg,
#widget-launcher-btn.is-white-bg {
  background: #FFFFFF !important;
  border: 2.5px solid #2563EB !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35) !important;
}

.theme-tac .nexa-chat-footer-brand a {
  color: #2563EB !important;
}

/* Legacy Chat Input Bar */
.nexa-chat-input-area {
  padding: 0.75rem 1rem;
  background: #FFFFFF;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  border: 1px solid #D1D5DB;
  border-radius: var(--radius-full);
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: #F97316;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #EA580C;
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chat-send-btn:hover {
  background: #C2410C;
}

/* Typing Indicator Animation */
.typing-dots {
  display: inline-flex;
  gap: 3px;
  padding: 6px 10px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ==========================================================================
   Standalone External Website Embed Styles
   ========================================================================== */
.nexa-embed-floating {
  position: fixed !important;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  right: calc(24px + env(safe-area-inset-right, 0px)) !important;
  z-index: 2147483645 !important;
  font-family: var(--font-sans);
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.nexa-chat-footer-brand {
  text-align: center;
  font-size: 0.72rem;
  color: #9CA3AF;
  padding: 0.45rem;
  background: #FFFFFF;
  border-top: 1px solid #F3F4F6;
  user-select: none;
}

.nexa-chat-footer-brand a {
  color: #EA580C;
  text-decoration: none;
  font-weight: 700;
}

/* Responsive Styles for Chat Stage & Mascot */
@media (max-width: 768px) {
  #widget-chat-stage,
  .nexa-chat-stage {
    gap: 12px !important;
    right: 16px !important;
    bottom: 16px !important;
    left: auto !important;
    top: auto !important;
    z-index: 2147483647 !important;
  }
  #widget-mascot-img,
  .nexa-mascot-img {
    width: 140px !important;
    max-height: 320px !important;
  }
  #widget-chat-column,
  .nexa-chat-column {
    width: 340px !important;
    flex: 0 0 340px !important;
  }
  #widget-chat-window,
  .nexa-chat-column .nexa-chat-window {
    height: 480px !important;
    max-height: calc(100vh - 90px) !important;
  }
}

@media (max-width: 640px) {
  #widget-chat-stage,
  .nexa-chat-stage {
    position: fixed !important;
    right: 12px !important;
    bottom: 12px !important;
    left: auto !important; /* CRITICAL: Never stretch to left edge, avoid going behind sidebar */
    top: auto !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    gap: 0 !important;
    justify-content: flex-end !important;
    z-index: 2147483647 !important;
  }
  /* On mobile <= 640px, hide standing mascot so chat window card fits cleanly without horizontal blowout */
  #widget-mascot-wrapper,
  .nexa-mascot-wrapper {
    display: none !important;
  }
  #widget-chat-column,
  .nexa-chat-column {
    width: 360px !important;
    max-width: calc(100vw - 24px) !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }
  #widget-chat-window,
  .nexa-chat-column .nexa-chat-window {
    height: calc(100vh - 84px) !important;
    max-height: calc(100vh - 84px) !important;
    border-radius: 20px !important;
  }
}

/* Ensure Inside Simulator Container ALWAYS overrides media queries and stays bounded */
.wp-simulator-wrapper #widget-chat-stage,
.wp-simulator-wrapper .nexa-chat-stage {
  position: absolute !important;
  bottom: 20px !important;
  right: 24px !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  max-width: calc(100% - 48px) !important;
  z-index: 95 !important;
}

.wp-simulator-wrapper #widget-chat-column,
.wp-simulator-wrapper .nexa-chat-column {
  width: 380px !important;
  max-width: calc(100% - 24px) !important;
  flex: 0 0 380px !important;
}
