/* Modern live-chat messaging — storefront widget */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chatbot-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.chatbot-agent-avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.chatbot-agent-avatar-inner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

.chatbot-status-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #6366f1;
  background: #94a3b8;
}

.chatbot-status-dot.is-online {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: chatStatusPulse 2s infinite;
}

.chatbot-status-dot.is-offline {
  background: #94a3b8;
}

@keyframes chatStatusPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.chatbot-header-meta {
  min-width: 0;
}

#chatbot-header-title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #fff !important;
  margin: 0 !important;
  line-height: 1.25 !important;
}

#chatbot-header-status {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.3;
}

.chatbot-messages {
  scroll-behavior: smooth;
}

.chat-msg-day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chat-msg-day-divider::before,
.chat-msg-day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.chat-msg-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  animation: chatMsgIn 0.28s ease;
}

.chat-msg-row--grouped {
  margin-bottom: 4px;
}

.chat-msg-row--grouped .chat-msg-avatar,
.chat-msg-row--grouped .chat-msg-meta {
  visibility: hidden;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.chat-msg-row--visitor,
.chat-msg-row--user {
  flex-direction: row-reverse;
}

.chat-msg-row--visitor .chat-msg-content,
.chat-msg-row--user .chat-msg-content {
  align-items: flex-end;
}

.chat-msg-row--system {
  justify-content: center;
}

.chat-msg-row--system .chat-msg-bubble {
  background: #eef2ff;
  border: 1px solid #dbeafe;
  color: #475569;
  font-size: 12px;
  border-radius: 999px;
  padding: 6px 12px;
  max-width: 92%;
  text-align: center;
}

.chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.chat-msg-row--visitor .chat-msg-avatar,
.chat-msg-row--user .chat-msg-avatar {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.chat-msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 40px);
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
}

.chat-msg-row--visitor .chat-msg-meta,
.chat-msg-row--user .chat-msg-meta {
  flex-direction: row-reverse;
}

.chat-msg-sender {
  font-weight: 600;
  color: #334155;
}

.chat-msg-bubble {
  position: relative;
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 13px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg-row--agent .chat-msg-bubble,
.chat-msg-row--bot .chat-msg-bubble {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.chat-msg-row--visitor .chat-msg-bubble,
.chat-msg-row--user .chat-msg-bubble {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.28);
}

.chat-msg-bubble p {
  margin: 0;
}

.chat-msg-bubble a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.chat-msg-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  opacity: 0.82;
}

.chat-msg-row--visitor .chat-msg-footer,
.chat-msg-row--user .chat-msg-footer {
  justify-content: flex-end;
}

.chat-msg-status {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.chat-msg-status.is-sending { opacity: 0.65; }
.chat-msg-status.is-sent { opacity: 0.9; }
.chat-msg-status.is-delivered { opacity: 1; }

.chat-msg-bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  min-width: 56px;
}

.chat-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: chatTypingBounce 1.2s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-typing-indicator {
  padding: 0 14px 8px !important;
  font-style: normal !important;
}

.chatbot-typing-indicator .chat-msg-row {
  margin-bottom: 0;
}

.chatbot-composer {
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.chatbot-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-composer-inner:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: #fff;
}

.chatbot-input {
  flex: 1;
  border: 0 !important;
  background: transparent !important;
  padding: 8px 0 !important;
  font-size: 13px !important;
  outline: none !important;
  box-shadow: none !important;
  min-height: 20px;
}

.chatbot-send-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  border-radius: 50% !important;
  border: 0 !important;
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.chatbot-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chatbot-quick-replies {
  padding: 8px 12px !important;
  gap: 6px !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  max-height: none !important;
  border-top: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
}

.quick-reply-btn {
  flex: 1 1 calc(50% - 6px);
  border-radius: 999px !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
}

.chatbot-rating-stars {
  display: flex;
  gap: 4px;
}

.chatbot-rating-star {
  font-size: 22px !important;
  line-height: 1;
  transition: transform 0.15s;
}

.chatbot-rating-star:hover:not(:disabled) {
  transform: scale(1.15);
}

.chatbot-contact-form {
  border-top: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
}

.chatbot-quote-trigger {
  flex: 1 1 100% !important;
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
  font-weight: 600 !important;
}

.chatbot-quote-textarea {
  min-height: 56px;
  resize: vertical;
}

.chatbot-proactive-invite {
  position: absolute;
  bottom: 0;
  right: 0;
  width: min(340px, calc(100vw - 28px));
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 0;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.04),
    0 20px 40px -12px rgba(15, 23, 42, 0.22),
    0 8px 16px -8px rgba(99, 102, 241, 0.15);
  z-index: 2;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1), transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chatbot-widget.is-live-support-mode {
  width: min(340px, calc(100vw - 28px)) !important;
  height: auto !important;
  min-height: 0 !important;
}

.chatbot-widget.is-live-support-mode #chatbot-toggle {
  display: none !important;
}

.chatbot-widget.is-live-support-mode .chatbot-proactive-invite {
  position: relative;
  bottom: auto;
  right: auto;
  width: 100%;
}

.chatbot-proactive-invite.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-proactive-invite.hidden {
  display: none !important;
}

.chatbot-proactive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #8b5cf6 100%);
  color: #fff;
}

.chatbot-proactive-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chatbot-proactive-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.chatbot-proactive-live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.65);
  animation: chatbotLivePulse 2s ease-out infinite;
}

@keyframes chatbotLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.chatbot-proactive-brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  opacity: 0.95;
}

.chatbot-proactive-dismiss,
.chatbot-proactive-minimize {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chatbot-proactive-minimize:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.04);
}

.chatbot-proactive-body {
  padding: 16px 16px 18px;
  background: linear-gradient(180deg, #fafbff 0%, #ffffff 100%);
}

.chatbot-proactive-invite.is-minimized {
  width: 52px !important;
  height: 52px !important;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  border-radius: 50%;
}

.chatbot-proactive-restore {
  display: none;
  position: relative;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow:
    0 10px 24px rgba(99, 102, 241, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}

.chatbot-proactive-restore:not(.hidden) {
  display: flex;
}

.chatbot-proactive-restore:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 16px 32px rgba(99, 102, 241, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.16) inset;
}

.chatbot-proactive-restore-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.35);
  animation: chatbotRestoreRing 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes chatbotRestoreRing {
  0% { transform: scale(0.92); opacity: 0.9; }
  100% { transform: scale(1.18); opacity: 0; }
}

.chatbot-proactive-restore-avatar {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chatbot-proactive-restore-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4ade80;
  border: 2.5px solid #6366f1;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.chatbot-widget.is-live-support-minimized {
  width: 52px !important;
  height: 52px !important;
  min-height: 0 !important;
}

.chatbot-widget.is-live-support-minimized .chatbot-proactive-invite {
  width: 52px !important;
  height: 52px !important;
}

.chatbot-proactive-agent {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chatbot-proactive-avatar {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6366f1 0%, #7c3aed 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow:
    0 4px 14px rgba(99, 102, 241, 0.35),
    0 0 0 3px rgba(99, 102, 241, 0.12);
}

.chatbot-proactive-avatar-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4ade80;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

.chatbot-proactive-agent-meta {
  min-width: 0;
}

.chatbot-proactive-agent-meta strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.chatbot-proactive-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #059669;
  font-weight: 500;
}

.chatbot-proactive-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: chatbotLivePulse 2s ease-out infinite;
}

.chatbot-proactive-bubble {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e8ecf4;
  border-radius: 16px 16px 16px 6px;
  position: relative;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.chatbot-proactive-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: #475569;
  letter-spacing: -0.01em;
}

.chatbot-proactive-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 13px 18px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.chatbot-proactive-open svg {
  flex-shrink: 0;
  opacity: 0.95;
}

.chatbot-proactive-open:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.42);
  filter: brightness(1.03);
}

.chatbot-proactive-open:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

@media (max-width: 767px) {
  .quick-reply-btn {
    flex: 1 1 100%;
  }

  .chatbot-proactive-invite,
  .chatbot-widget.is-live-support-mode {
    width: min(320px, calc(100vw - 20px)) !important;
  }

  .chatbot-proactive-body {
    padding: 14px 14px 16px;
  }

  .chatbot-proactive-agent-meta strong {
    font-size: 14px;
  }
}
