/* pxl.chat visitor widget */
.pxlchat-root {
  --pxlchat-accent: #4f46e5;
  --pxlchat-bg: #ffffff;
  --pxlchat-fg: #1c2024;
  --pxlchat-muted: #8b8d98;
  --pxlchat-border: #e8e8ec;
  --pxlchat-surface: #f8f8fa;
  --pxlchat-radius: 18px;
  --pxlchat-shadow: 0 12px 40px rgba(16, 17, 26, .18), 0 2px 8px rgba(16, 17, 26, .08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}
.pxlchat-root *, .pxlchat-root *::before, .pxlchat-root *::after { box-sizing: border-box; }

/* ---- Float placement ---- */
.pxlchat-float { position: fixed; bottom: 22px; z-index: 2147483000; }
.pxlchat-float.pxlchat-pos-right { right: 22px; }
.pxlchat-float.pxlchat-pos-left { left: 22px; }

/* ---- Launcher ---- */
.pxlchat-launcher {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--pxlchat-accent); color: #fff; border: 0;
  border-radius: 999px; padding: 13px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; box-shadow: var(--pxlchat-shadow);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.pxlchat-launcher:hover { transform: translateY(-2px); }
.pxlchat-launcher:active { transform: translateY(0); }
.pxlchat-launcher svg { display: block; }
.pxlchat-float.pxlchat-open .pxlchat-launcher { opacity: 0; transform: scale(.85); pointer-events: none; }

/* ---- Panel ---- */
.pxlchat-panel {
  width: 384px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px);
  background: var(--pxlchat-bg); color: var(--pxlchat-fg);
  border: 1px solid var(--pxlchat-border); border-radius: var(--pxlchat-radius);
  box-shadow: var(--pxlchat-shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.pxlchat-float .pxlchat-panel {
  position: absolute; bottom: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(12px) scale(.97); transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1), visibility .22s;
}
.pxlchat-float.pxlchat-pos-left .pxlchat-panel { transform-origin: bottom left; left: 0; }
.pxlchat-float.pxlchat-pos-right .pxlchat-panel { right: 0; }
.pxlchat-float.pxlchat-open .pxlchat-panel {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1);
}
.pxlchat-inline .pxlchat-panel { position: relative; height: 520px; }

/* ---- Header ---- */
.pxlchat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; color: #fff;
  background: linear-gradient(135deg, var(--pxlchat-accent), color-mix(in srgb, var(--pxlchat-accent) 75%, #000 25%));
}
.pxlchat-id { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15.5px; }
.pxlchat-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.22);
}
.pxlchat-avatar svg { width: 17px; height: 17px; }
.pxlchat-actions { display: flex; align-items: center; gap: 6px; }
.pxlchat-close, .pxlchat-reset {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.14); color: #fff; cursor: pointer; transition: background .15s ease;
}
.pxlchat-close:hover, .pxlchat-reset:hover { background: rgba(255,255,255,.28); }

/* ---- Log ---- */
.pxlchat-log { flex: 1; overflow-y: auto; padding: 16px; background: var(--pxlchat-surface); scroll-behavior: smooth; }
.pxlchat-log::-webkit-scrollbar { width: 8px; }
.pxlchat-log::-webkit-scrollbar-thumb { background: #d7d7dd; border-radius: 8px; }

/* ---- Messages ---- */
.pxlchat-msg {
  max-width: 86%; padding: 11px 14px; margin-bottom: 11px; font-size: 14.5px; line-height: 1.5;
  border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere;
  opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease;
}
.pxlchat-msg.pxlchat-in { opacity: 1; transform: translateY(0); }
.pxlchat-user {
  margin-left: auto; background: var(--pxlchat-accent); color: #fff; border-bottom-right-radius: 5px;
}
.pxlchat-bot {
  background: var(--pxlchat-bg); color: var(--pxlchat-fg);
  border: 1px solid var(--pxlchat-border); border-bottom-left-radius: 5px;
}
.pxlchat-bot p { margin: 0 0 8px; } .pxlchat-bot p:last-child { margin-bottom: 0; }
.pxlchat-bot ul, .pxlchat-bot ol { margin: 6px 0; padding-left: 20px; }
.pxlchat-bot li { margin: 3px 0; }
.pxlchat-bot h1, .pxlchat-bot h2, .pxlchat-bot h3 { margin: 10px 0 6px; font-size: 15px; }
.pxlchat-bot a { color: var(--pxlchat-accent); font-weight: 600; }
.pxlchat-bot code { background: var(--pxlchat-surface); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.pxlchat-bot pre { background: #1c2024; color: #e8e8ec; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.pxlchat-bot pre code { background: none; padding: 0; color: inherit; }

/* ---- Typing ---- */
.pxlchat-dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.pxlchat-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pxlchat-muted); display: inline-block; animation: pxlchat-bounce 1.3s infinite ease-in-out; }
.pxlchat-dots i:nth-child(2) { animation-delay: .18s; }
.pxlchat-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes pxlchat-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---- Composer ---- */
.pxlchat-form { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--pxlchat-border); background: var(--pxlchat-bg); }
.pxlchat-input {
  flex: 1; border: 1px solid var(--pxlchat-border); background: var(--pxlchat-surface);
  border-radius: 12px; padding: 11px 13px; font-size: 14.5px; outline: none; color: var(--pxlchat-fg);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pxlchat-input:focus { border-color: var(--pxlchat-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pxlchat-accent) 22%, transparent); }
.pxlchat-send {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 12px;
  background: var(--pxlchat-accent); color: #fff; cursor: pointer; transition: transform .12s ease, filter .15s ease;
}
.pxlchat-send:hover { filter: brightness(1.07); }
.pxlchat-send:active { transform: scale(.94); }

/* Force icon sizes so a host theme's generic `svg { width: 1em }` (or a
   zero font-size on buttons) can't collapse our icons to a dot. */
.pxlchat-root button { font-size: 16px; line-height: 0; }
.pxlchat-root svg { display: block; box-sizing: content-box; }
.pxlchat-root .pxlchat-launcher svg,
.pxlchat-root .pxlchat-send svg,
.pxlchat-root .pxlchat-close svg,
.pxlchat-root .pxlchat-reset svg { width: 20px !important; height: 20px !important; flex: 0 0 auto; }
.pxlchat-root .pxlchat-avatar svg { width: 18px !important; height: 18px !important; }

/* ---- Brand ---- */
.pxlchat-brand { text-align: center; font-size: 11px; color: var(--pxlchat-muted); padding: 7px 0 9px; background: var(--pxlchat-bg); }
.pxlchat-brand strong { color: var(--pxlchat-fg); }

@media (prefers-reduced-motion: reduce) {
  .pxlchat-launcher, .pxlchat-panel, .pxlchat-msg { transition: none; }
  .pxlchat-dots i { animation: none; }
}
