/* ==========================================================
   LumeX · Floating Chatbot Widget Premium Stylesheet
   Adapts to Light/Dark Mode natively using site variables
   ========================================================== */

/* Main container */
.lx-widget-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Geist', 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* Let clicks pass through except for actual buttons */
}

.lx-widget-container * {
  box-sizing: border-box;
  pointer-events: auto; /* Re-enable pointer events for widget contents */
}

/* ---------- FLOATING ACTION BUTTON (FAB) ---------- */
.lx-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 8px 32px rgba(0, 229, 160, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  outline: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  position: relative;
  animation: lx-fab-appear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.lx-fab:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 12px 40px rgba(0, 229, 160, 0.5);
}

.lx-fab:active {
  transform: scale(0.95);
}

.lx-fab svg {
  width: 26px;
  height: 26px;
  fill: #FFFFFF;
  transition: transform 0.3s ease;
}

.lx-fab.is-open svg {
  transform: rotate(90deg) scale(0.85);
}

/* FAB active dot indicator */
.lx-fab__status {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lx-mint);
  border: 2px solid var(--lx-white);
  box-shadow: 0 0 8px var(--lx-mint);
  animation: lx-pulse-dot 1.8s infinite;
}

/* Floating Intro Tooltip / Callout */
.lx-fab-tooltip {
  position: absolute;
  right: 75px;
  bottom: 10px;
  background: var(--lx-white);
  color: var(--lx-ink);
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid var(--lx-line);
  box-shadow: 0 10px 25px rgba(10, 37, 64, 0.08);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(15px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lx-fab-tooltip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--lx-white);
  border-right: 1px solid var(--lx-line);
  border-top: 1px solid var(--lx-line);
}

.lx-fab-tooltip.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.lx-fab-tooltip__close {
  background: transparent;
  border: none;
  color: var(--lx-slate);
  cursor: pointer;
  font-size: 14px;
  padding: 0 0 0 6px;
  margin-left: 6px;
  border-left: 1px solid var(--lx-line);
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease;
}

.lx-fab-tooltip__close:hover {
  color: var(--lx-coral);
}


/* ---------- CHAT WINDOW ---------- */
.lx-chat-window {
  width: 360px;
  height: 520px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--lx-line);
  box-shadow: 0 24px 64px -16px rgba(10, 37, 64, 0.18);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

/* Window active state */
.lx-chat-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Dark mode adjust */
[data-theme="dark"] .lx-chat-window {
  background: rgba(17, 38, 56, 0.88);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.5);
}

/* ---------- CHAT HEADER ---------- */
.lx-chat-header {
  background: var(--lx-ink);
  color: var(--lx-white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--lx-deep-line);
  position: relative;
}

/* Brand Gradient bar on top */
.lx-chat-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad);
}

/* Header Avatar */
.lx-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lx-chat-avatar svg {
  width: 22px;
  height: 22px;
}

/* Mini active indicator */
.lx-chat-avatar__status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lx-mint);
  border: 2px solid var(--lx-ink);
  box-shadow: 0 0 6px var(--lx-mint);
}

/* Name details */
.lx-chat-info {
  flex: 1;
}

.lx-chat-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--lx-white);
}

.lx-chat-desc {
  font-size: 11px;
  color: var(--lx-slate);
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lx-chat-desc::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lx-mint);
}

/* Close action */
.lx-chat-close {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--lx-slate);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lx-chat-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--lx-white);
  transform: scale(1.05);
}

.lx-chat-close svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}


/* ---------- CHAT BODY (SCROLLABLE AREA) ---------- */
.lx-chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--lx-bone);
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* Scrollbar styles */
.lx-chat-body::-webkit-scrollbar {
  width: 5px;
}
.lx-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.lx-chat-body::-webkit-scrollbar-thumb {
  background: var(--lx-line);
  border-radius: 99px;
}
.lx-chat-body::-webkit-scrollbar-thumb:hover {
  background: var(--lx-slate);
}


/* ---------- MESSAGE BUBBLES ---------- */
.lx-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  position: relative;
  animation: lx-bubble-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  word-break: break-word;
}

.lx-message p {
  margin: 0 0 4px;
}

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

.lx-message strong {
  font-weight: 600;
}

/* Time display */
.lx-message-time {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  color: var(--lx-slate);
  display: block;
  text-align: right;
  margin-top: 4px;
  opacity: 0.75;
}

/* Incoming bubble (Bot) */
.lx-message--in {
  background: var(--lx-white);
  color: var(--lx-ink);
  border: 1px solid var(--lx-line);
  align-self: flex-start;
  border-top-left-radius: 0;
}

[data-theme="dark"] .lx-message--in {
  border-color: rgba(255, 255, 255, 0.05);
}

/* Outgoing bubble (User) */
.lx-message--out {
  background: var(--lx-ink);
  color: var(--lx-white);
  align-self: flex-end;
  border-top-right-radius: 0;
}

[data-theme="dark"] .lx-message--out {
  background: rgba(0, 229, 160, 0.12);
  color: var(--lx-mint);
  border: 1px solid rgba(0, 229, 160, 0.2);
}

[data-theme="dark"] .lx-message--out .lx-message-time {
  color: var(--lx-mint);
  opacity: 0.6;
}

/* System Notifications */
.lx-message--system {
  align-self: center;
  max-width: 90%;
  background: rgba(255, 200, 87, 0.08);
  border: 1px dashed var(--lx-amber);
  color: var(--lx-ink);
  font-size: 11px;
  text-align: center;
  border-radius: 8px;
  padding: 8px 12px;
  animation: lx-fade-in-anim 0.4s ease both;
}

[data-theme="dark"] .lx-message--system {
  background: rgba(255, 214, 128, 0.04);
  color: var(--lx-amber);
}

.lx-message--system em {
  font-style: italic;
  font-family: inherit;
  color: inherit;
}


/* ---------- TYPING INDICATOR ---------- */
.lx-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--lx-white);
  border: 1px solid var(--lx-line);
  border-radius: 14px;
  border-top-left-radius: 0;
  align-self: flex-start;
  animation: lx-bubble-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lx-typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--lx-slate);
  border-radius: 50%;
  display: inline-block;
  animation: lx-typing-bounce 1.4s infinite both;
}

.lx-typing-indicator span:nth-child(2) { animation-delay: .2s; }
.lx-typing-indicator span:nth-child(3) { animation-delay: .4s; }


/* ---------- QUICK REPLIES ---------- */
.lx-quick-replies {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: var(--lx-bone);
  border-top: 1px solid var(--lx-line);
  overflow-x: auto;
  white-space: nowrap;
  scroll-behavior: smooth;
}

.lx-quick-replies::-webkit-scrollbar {
  height: 4px;
}
.lx-quick-replies::-webkit-scrollbar-track {
  background: transparent;
}
.lx-quick-replies::-webkit-scrollbar-thumb {
  background: rgba(10, 37, 64, 0.08);
  border-radius: 99px;
}

.lx-quick-reply-btn {
  background: var(--lx-white);
  border: 1px solid var(--lx-line);
  color: var(--lx-ink);
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lx-quick-reply-btn:hover {
  background: var(--lx-ink);
  color: var(--lx-white);
  border-color: var(--lx-ink);
  transform: translateY(-1.5px);
}

[data-theme="dark"] .lx-quick-reply-btn {
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .lx-quick-reply-btn:hover {
  background: var(--lx-mint);
  color: var(--lx-ink);
  border-color: var(--lx-mint);
}


/* ---------- CHAT FOOTER (INPUT AREA) ---------- */
.lx-chat-footer {
  padding: 12px 20px;
  background: var(--lx-white);
  border-top: 1px solid var(--lx-line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.lx-chat-input-wrapper {
  position: relative;
  flex: 1;
}

.lx-chat-input {
  width: 100%;
  border: 1px solid var(--lx-line);
  background: var(--lx-bone);
  color: var(--lx-ink);
  border-radius: 20px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}

.lx-chat-input:focus {
  border-color: var(--lx-ink);
  background: var(--lx-white);
}

[data-theme="dark"] .lx-chat-input:focus {
  border-color: var(--lx-mint);
}

/* Send Button */
.lx-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--lx-bone);
  border: none;
  color: var(--lx-slate);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lx-chat-send.active {
  background: var(--grad);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 229, 160, 0.3);
}

.lx-chat-send.active:hover {
  transform: scale(1.06);
}

.lx-chat-send.active:active {
  transform: scale(0.94);
}

.lx-chat-send svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transform: translateX(1px);
}


/* ---------- PREMIUM GLASSMORPHIC ESCALATION POPUP ---------- */
.lx-escalation-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 37, 64, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lx-escalation-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.lx-escalation-card {
  background: var(--lx-white);
  border: 1px solid var(--lx-line);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border-radius: var(--r);
  padding: 28px 24px;
  text-align: center;
  max-width: 290px;
  transform: scale(0.85);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lx-escalation-modal.show .lx-escalation-card {
  transform: scale(1);
}

.lx-escalation-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 229, 160, 0.12);
  color: var(--lx-mint);
  border: 1px solid var(--lx-mint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 22px;
  animation: lx-pulse-alert 1.5s infinite;
}

.lx-escalation-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--lx-ink);
  margin: 0 0 8px;
}

.lx-escalation-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--lx-slate);
  margin: 0 0 20px;
}

.lx-escalation-btn {
  background: var(--lx-ink);
  color: var(--lx-white);
  border: none;
  font-weight: 600;
  font-size: 12px;
  padding: 8px 20px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lx-escalation-btn:hover {
  background: var(--lx-mint);
  color: var(--lx-ink);
}

[data-theme="dark"] .lx-escalation-card {
  background: #112638;
}
[data-theme="dark"] .lx-escalation-btn {
  background: var(--lx-mint);
  color: var(--lx-ink);
}
[data-theme="dark"] .lx-escalation-btn:hover {
  background: var(--lx-white);
}


/* ---------- ANIMATIONS & KEYFRAMES ---------- */
@keyframes lx-fab-appear {
  from { transform: scale(0) rotate(-45deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes lx-bubble-in {
  from { transform: translateY(12px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes lx-fade-in-anim {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lx-pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(0, 229, 160, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(0, 229, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 160, 0); }
}

@keyframes lx-pulse-alert {
  0% { box-shadow: 0 0 0 0 rgba(0, 229, 160, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(0, 229, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 160, 0); }
}

@keyframes lx-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}


/* ---------- RESPONSIVE MOBILE TWEAKS ---------- */
@media (max-width: 480px) {
  .lx-widget-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    align-items: stretch;
  }
  .lx-fab {
    align-self: flex-end;
    width: 50px;
    height: 50px;
  }
  .lx-fab svg {
    width: 22px;
    height: 22px;
  }
  .lx-fab-tooltip {
    right: 62px;
    bottom: 5px;
    font-size: 12px;
    padding: 10px 14px;
  }
  .lx-chat-window {
    width: 100%;
    height: calc(100vh - 100px);
    max-height: 540px;
    margin-bottom: 12px;
  }
}
