/* Prolong Lash chat widget — scoped under #pl-chat-root to avoid leaking into theme styles */
#pl-chat-root {
  --pl-accent: var(--pl-chat-accent, #b8879b);
  --pl-accent-text: var(--pl-chat-accent-text, #ffffff);
  --pl-bg: #ffffff;
  --pl-text: #1f1a1c;
  --pl-muted: #766f71;
  --pl-border: #ece5e7;
  --pl-radius: 16px;
  all: initial;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  position: fixed;
  z-index: 2147483000;
  bottom: 20px;
  right: 20px;
  display: block;
}
#pl-chat-root.pl-pos-left { right: auto; left: 20px; }
#pl-chat-root * { box-sizing: border-box; }

.pl-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--pl-accent);
  color: var(--pl-accent-text);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.pl-bubble:hover { transform: scale(1.06); }
.pl-bubble svg { width: 26px; height: 26px; }

.pl-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #d64545;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.pl-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 370px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--pl-bg);
  border-radius: var(--pl-radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98) translateZ(0);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  backface-visibility: hidden;
  will-change: transform, opacity;
}
#pl-chat-root.pl-pos-left .pl-panel { right: auto; left: 0; }
#pl-chat-root.pl-open .pl-panel {
  opacity: 1;
  transform: translateY(0) scale(1) translateZ(0);
  pointer-events: auto;
}

.pl-header {
  background: var(--pl-accent);
  color: var(--pl-accent-text);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pl-header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.pl-header-text { flex: 1; min-width: 0; }
.pl-header-title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.pl-header-sub { font-size: 12px; opacity: 0.85; }
.pl-close {
  background: transparent; border: none; color: inherit; cursor: pointer;
  opacity: 0.85; padding: 4px; line-height: 0;
}
.pl-close:hover { opacity: 1; }

.pl-messages {
  flex: 1;
  overflow-y: auto;
  overflow-anchor: none;
  contain: content;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbf9fa;
}

.pl-msg { max-width: 82%; font-size: 14px; line-height: 1.45; }
.pl-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--pl-border);
  color: var(--pl-text);
  padding: 10px 13px;
  border-radius: 14px 14px 14px 4px;
  white-space: pre-wrap;
}
.pl-msg-user {
  align-self: flex-end;
  background: var(--pl-accent);
  color: var(--pl-accent-text);
  padding: 10px 13px;
  border-radius: 14px 14px 4px 14px;
  white-space: pre-wrap;
}
.pl-msg-system {
  align-self: center;
  color: var(--pl-muted);
  font-size: 12px;
  text-align: center;
  padding: 4px 10px;
}

.pl-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 13px;
  background: #fff;
  border: 1px solid var(--pl-border);
  border-radius: 14px 14px 14px 4px;
}
.pl-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pl-muted);
  animation: pl-bounce 1.2s infinite ease-in-out;
}
.pl-typing span:nth-child(2) { animation-delay: 0.15s; }
.pl-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pl-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.6; } 30% { transform: translateY(-4px); opacity: 1; } }

.pl-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: #fbf9fa;
}
.pl-chip {
  border: 1px solid var(--pl-accent);
  color: var(--pl-accent);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pl-chip:hover { background: color-mix(in srgb, var(--pl-accent) 10%, #fff); }

.pl-escalate-form {
  padding: 12px 16px;
  border-top: 1px solid var(--pl-border);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pl-escalate-form input {
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
}
.pl-escalate-form button {
  background: var(--pl-accent);
  color: var(--pl-accent-text);
  border: none;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pl-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--pl-border);
  background: #fff;
}
.pl-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--pl-border);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  max-height: 90px;
  line-height: 1.4;
}
.pl-input-row textarea:focus { outline: 2px solid var(--pl-accent); outline-offset: 1px; }
.pl-send {
  background: var(--pl-accent);
  color: var(--pl-accent-text);
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pl-send:disabled { opacity: 0.5; cursor: default; }
.pl-send svg { width: 18px; height: 18px; }

.pl-footer-note {
  font-size: 10.5px;
  color: var(--pl-muted);
  text-align: center;
  padding: 6px 0 10px;
  background: #fff;
}

@media (max-width: 480px) {
  .pl-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 110px);
    bottom: 72px;
  }
}
