/* ==========================================================================
   WBA / ONGO LIVE CHAT WIDGET - ULTRA-MODERN PREMIUM REDESIGN
   Maximum contrast, crystal-clear readability & fluid micro-interactions
   ========================================================================== */

/* 1. FLOATING LAUNCH TRIGGER */
.live-chat-widget {
  position: fixed !important;
  right: 24px !important;
  bottom: 24px !important;
  z-index: 99999 !important;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif !important;
}

.live-chat-widget * {
  box-sizing: border-box !important;
}

.live-chat-launch {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 18px 10px 12px !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #090e17 0%, #0f172a 60%, #1e3a8a 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 10px 25px -4px rgba(37, 99, 235, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
  outline: none !important;
}

.live-chat-launch:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 0 16px 36px -6px rgba(37, 99, 235, 0.5), 0 6px 16px rgba(0, 0, 0, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.live-chat-launch:active {
  transform: translateY(0) scale(0.98) !important;
}

.live-chat-launch strong {
  display: grid !important;
  place-items: center !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
  color: #ffffff !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5) !important;
  position: relative !important;
}

.live-chat-launch span {
  font-size: 13.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em !important;
  color: #ffffff !important;
  white-space: nowrap !important;
}

/* 2. CHAT WINDOW CONTAINER */
.live-chat-window {
  position: absolute !important;
  right: 0 !important;
  bottom: 64px !important;
  width: 380px !important;
  max-width: calc(100vw - 28px) !important;
  height: 570px !important;
  max-height: calc(100vh - 110px) !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 22px !important;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  transform-origin: bottom right !important;
  animation: liveChatPopIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.live-chat-window[hidden] {
  display: none !important;
}

@keyframes liveChatPopIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 3. MODERN GRADIENT HEADER */
.live-chat-window header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 18px !important;
  background: linear-gradient(135deg, #090e17 0%, #0f172a 60%, #1e3a8a 100%) !important;
  color: #ffffff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  flex-shrink: 0 !important;
}

.live-chat-window header div {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.live-chat-window header b {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  letter-spacing: -0.01em !important;
  line-height: 1.2 !important;
}

.live-chat-window header small {
  font-size: 11.5px !important;
  color: #94a3b8 !important;
  font-weight: 500 !important;
  opacity: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.live-chat-window header small::before {
  content: "" !important;
  display: inline-block !important;
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #10b981 !important;
  box-shadow: 0 0 8px #10b981 !important;
}

.live-chat-window header button[data-live-close] {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  display: grid !important;
  place-items: center !important;
  font-size: 20px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
}

.live-chat-window header button[data-live-close]:hover {
  background: rgba(255, 255, 255, 0.24) !important;
  transform: rotate(90deg) !important;
}

/* 4. PRE-CHAT ONBOARDING SCREEN */
.live-chat-start {
  padding: 24px 20px !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  flex-grow: 1 !important;
  overflow-y: auto !important;
}

.live-chat-start[hidden] {
  display: none !important;
}

.live-chat-start p {
  margin: 0 !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.4 !important;
  background: #f8fafc !important;
  padding: 12px 14px !important;
  border-radius: 12px !important;
  border-left: 3px solid #2563eb !important;
}

.live-chat-start input {
  width: 100% !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  font-size: 13.5px !important;
  color: #0f172a !important;
  background: #ffffff !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.live-chat-start input::placeholder {
  color: #94a3b8 !important;
}

.live-chat-start input:focus {
  border-color: #2563eb !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.live-contact-note {
  font-size: 11.5px !important;
  color: #64748b !important;
  line-height: 1.4 !important;
  margin: -4px 0 4px !important;
  display: block !important;
}

.live-chat-start .btn {
  width: 100% !important;
  padding: 13px !important;
  border-radius: 12px !important;
  border: none !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
  transition: all 0.2s ease !important;
  text-align: center !important;
}

.live-chat-start .btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45) !important;
}

/* 5. CONVERSATION VIEW */
.live-chat-conversation {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  min-height: 0 !important;
  background: #f8fafc !important;
}

.live-chat-conversation[hidden] {
  display: none !important;
}

/* Session Top Bar */
.live-chat-sessionbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 16px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  flex-shrink: 0 !important;
}

.live-chat-sessionbar [data-live-state] {
  color: #0f172a !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.live-chat-sessionbar [data-live-state]::before {
  content: "" !important;
  display: inline-block !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: #10b981 !important;
  box-shadow: 0 0 6px #10b981 !important;
}

.live-chat-sessionbar button[data-live-end] {
  border: 1px solid #fecaca !important;
  border-radius: 8px !important;
  background: #fee2e2 !important;
  color: #dc2626 !important;
  padding: 5px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.live-chat-sessionbar button[data-live-end]:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}

/* Queue Card */
.live-queue {
  margin: 10px 14px 0 !important;
  padding: 11px 14px !important;
  border-radius: 12px !important;
  border: 1px solid #bfdbfe !important;
  background: #eff6ff !important;
  color: #1e40af !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  font-size: 12px !important;
}

.live-queue b {
  color: #1e3a8a !important;
  font-weight: 800 !important;
}

.live-queue strong {
  color: #2563eb !important;
}

/* 6. MESSAGES AREA & BUBBLES - MAXIMUM READABILITY */
.live-chat-messages {
  flex-grow: 1 !important;
  height: 310px !important;
  overflow-y: auto !important;
  padding: 16px 14px !important;
  background: #f8fafc !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

/* Message Bubble Shared */
.live-msg {
  max-width: 84% !important;
  padding: 11px 14px !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
  word-break: break-word !important;
  position: relative !important;
  transition: transform 0.15s ease !important;
}

.live-msg p {
  margin: 0 !important;
  white-space: pre-wrap !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
}

.live-msg small {
  display: block !important;
  margin-top: 5px !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  opacity: 1 !important;
}

/* ADMIN / REPRESENTATIVE BUBBLE (Left Aligned - Clean White Card) */
.live-msg.admin {
  align-self: flex-start !important;
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 18px 18px 18px 4px !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05) !important;
  color: #0f172a !important;
}

.live-msg.admin p {
  color: #0f172a !important;
  font-weight: 600 !important;
}

.live-msg.admin small {
  color: #64748b !important;
  text-align: left !important;
}

/* VISITOR / USER BUBBLE (Right Aligned - Royal Blue Gradient) */
.live-msg.visitor {
  align-self: flex-end !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 18px 18px 4px 18px !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28) !important;
  color: #ffffff !important;
}

.live-msg.visitor p {
  color: #ffffff !important;
  font-weight: 500 !important;
}

.live-msg.visitor small {
  color: rgba(255, 255, 255, 0.8) !important;
  text-align: right !important;
}

/* 7. MESSAGE INPUT BAR */
.live-chat-conversation form {
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 8px !important;
  padding: 12px 14px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  flex-shrink: 0 !important;
  align-items: center !important;
}

.live-chat-conversation textarea {
  width: 100% !important;
  min-height: 44px !important;
  max-height: 100px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  padding: 10px 14px !important;
  font-size: 13.5px !important;
  line-height: 1.4 !important;
  color: #0f172a !important;
  background: #f8fafc !important;
  font-family: inherit !important;
  resize: none !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.live-chat-conversation textarea::placeholder {
  color: #94a3b8 !important;
}

.live-chat-conversation textarea:focus {
  border-color: #2563eb !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.live-chat-conversation form .btn {
  border: none !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  padding: 0 18px !important;
  height: 44px !important;
  font-weight: 800 !important;
  font-size: 13.5px !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.live-chat-conversation form .btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4) !important;
}

/* 8. ERROR ALERT */
.live-chat-error {
  color: #dc2626 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 0 16px 10px !important;
  background: #ffffff !important;
}

.live-chat-error:empty {
  display: none !important;
}

/* 9. MOBILE RESPONSIVENESS */
@media (max-width: 600px) {
  .live-chat-widget {
    right: 14px !important;
    bottom: 14px !important;
  }
  .live-chat-window {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 74px !important;
    width: auto !important;
    max-width: none !important;
    height: calc(100vh - 90px) !important;
    max-height: 560px !important;
  }
  .live-chat-messages {
    height: calc(100vh - 280px) !important;
    max-height: 340px !important;
  }
}
