/* ==========================================================================
   paybot.in chat widget (js/chat.js). Every class starts with pbc- so nothing here touches the page.
   Uses the colour tokens from site.css. Floating panel on desktop, full screen below 600px.
   ========================================================================== */

.pbc-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 8px 20px 8px 12px; border: 0; border-radius: 999px;
  background: var(--blue-solid, #0d66e0); color: #fff; font: 700 1rem/1 var(--font, sans-serif);
  box-shadow: 0 12px 30px rgba(13, 102, 224, .35); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.pbc-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(13, 102, 224, .42); }
.pbc-launcher img { display: block; width: 40px; height: 30px; background: #fff; border-radius: 10px; padding: 2px; box-sizing: content-box; }
.pbc-bot {
  position: relative; display: inline-flex; flex: none;
  transform-origin: 50% 85%; animation: pbc-float 6s ease-in-out infinite;
}
.pbc-launcher:hover .pbc-bot, .pbc-launcher:focus-visible .pbc-bot { animation: pbc-wave .7s ease-in-out; }

/* Green "live" dot: on the robot's corner (it floats with it) and before "Online" in the panel header. It pings
   outwards every 2 seconds so the chat reads as switched on. */
.pbc-live {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box;
  background: #22c55e; border: 2px solid #fff; animation: pbc-live 2s ease-out infinite;
}
.pbc-bot .pbc-live { position: absolute; top: -4px; right: -4px; }
.pbc-head .pbc-live { width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; border-color: var(--navy, #09285c); }
@keyframes pbc-live {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

/* The robot (with its live dot) floats gently and tilts its head "hello" once every 6 seconds. */
@keyframes pbc-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-3px) rotate(0); }
  40% { transform: translateY(0) rotate(0); }
  48% { transform: translateY(-2px) rotate(-12deg); }
  56% { transform: translateY(-2px) rotate(10deg); }
  64% { transform: translateY(-1px) rotate(-6deg); }
  72% { transform: translateY(0) rotate(0); }
}
@keyframes pbc-wave {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg) scale(1.08); }
  60% { transform: rotate(12deg) scale(1.08); }
}

/* First visit: a soft ring pulses out of the button a few times, until the chat is opened once. */
.pbc-hello::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  animation: pbc-ring 2.4s ease-out 1.5s 4;
}
@keyframes pbc-ring {
  0% { box-shadow: 0 0 0 0 rgba(13, 102, 224, .55); }
  100% { box-shadow: 0 0 0 18px rgba(13, 102, 224, 0); }
}
.pbc-launcher:focus-visible { outline: 3px solid var(--navy, #09285c); outline-offset: 3px; }
@media (max-width: 599px) {
  .pbc-launcher { right: 16px; bottom: 16px; width: 60px; padding: 0; justify-content: center; }
  .pbc-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pbc-open .pbc-launcher { display: none; }
  html.pbc-open, html.pbc-open body { overflow: hidden; }
}

.pbc-panel {
  position: fixed; right: 20px; bottom: 92px; z-index: 71;
  display: flex; flex-direction: column;
  width: 390px; height: min(620px, calc(100vh - 120px));
  background: var(--white, #fff); color: var(--text, #1b2940);
  border: 1px solid var(--border, #e3eaf4); border-radius: var(--radius, 16px);
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(15, 50, 100, .14));
  font-family: var(--font, sans-serif); font-size: 15px; line-height: 1.5;
  overflow: hidden; animation: pbc-in .18s ease-out;
}
.pbc-panel[hidden] { display: none; }
@keyframes pbc-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 599px) {
  .pbc-panel { inset: 0; width: auto; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
}

.pbc-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  background: var(--navy, #09285c); color: #fff;
}
.pbc-head img { width: 40px; height: 30px; flex: none; transform-origin: 50% 85%; }
.pbc-thinking .pbc-head img { animation: pbc-think 1.1s ease-in-out infinite; }
@keyframes pbc-think {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-3px) rotate(-6deg); }
  70% { transform: translateY(-1px) rotate(6deg); }
}
.pbc-head div { flex: 1; min-width: 0; }
.pbc-head h2 { margin: 0; color: #fff; font-size: 1rem; line-height: 1.3; letter-spacing: 0; }
.pbc-head p { margin: 0; font-size: .8rem; color: #c9d8f0; }
.pbc-close {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer;
}
.pbc-close:hover { background: rgba(255, 255, 255, .12); }
.pbc-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.pbc-panel :focus-visible { outline: 3px solid var(--blue, #1677ff); outline-offset: 2px; }
.pbc-head :focus-visible { outline-color: #fff; }

.pbc-log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  background: var(--light, #f5f9ff);
}
.pbc-log:focus { outline: none; }
.pbc-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; overflow-wrap: anywhere; }
.pbc-msg p { margin: 0 0 .5em; }
.pbc-msg p:last-child, .pbc-msg ul:last-child, .pbc-msg ol:last-child { margin-bottom: 0; }
.pbc-msg ul, .pbc-msg ol { margin: 0 0 .5em; padding-left: 1.25em; }
.pbc-msg li { margin: .15em 0; }
.pbc-msg a { color: var(--blue-dark, #0b5fd9); font-weight: 600; }
.pbc-user {
  align-self: flex-end; white-space: pre-wrap;
  background: var(--blue-solid, #0d66e0); color: #fff; border-bottom-right-radius: 4px;
}
.pbc-assistant {
  align-self: flex-start;
  background: var(--white, #fff); border: 1px solid var(--border, #e3eaf4); border-bottom-left-radius: 4px;
}
.pbc-fallback { border-color: #f3d38b; background: #fffaf0; }
.pbc-contact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pbc-contact a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--border, #e3eaf4); border-radius: 999px; background: #fff;
  color: var(--navy, #09285c); font-weight: 700; font-size: .9rem; text-decoration: none;
}
.pbc-contact a.pbc-wa { background: var(--green-wa-dark, #15873f); border-color: transparent; color: #fff; }

.pbc-typing { display: flex; align-items: center; gap: 10px; }
.pbc-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.pbc-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #5d6a7f); animation: pbc-dot 1s infinite ease-in-out; }
.pbc-dots i:nth-child(2) { animation-delay: .15s; }
.pbc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pbc-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.pbc-wait { font-size: .85rem; color: var(--muted, #5d6a7f); }

.pbc-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; background: var(--light, #f5f9ff); }
.pbc-chips[hidden] { display: none; }
.pbc-chip {
  min-height: 40px; padding: 6px 14px; border: 1px solid #bcd3f5; border-radius: 999px;
  background: #fff; color: var(--blue-dark, #0b5fd9); font: 600 .9rem/1.2 var(--font, sans-serif); cursor: pointer;
}
.pbc-chip:hover { background: var(--light-2, #eaf2ff); }

.pbc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border, #e3eaf4); }
.pbc-form textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 10px 12px;
  border: 1px solid #c5d3e6; border-radius: 12px; font: 16px/1.4 var(--font, sans-serif); color: var(--text, #1b2940);
}
.pbc-form textarea:focus { border-color: var(--blue, #1677ff); outline: none; box-shadow: 0 0 0 3px rgba(22, 119, 255, .2); }
.pbc-send {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 12px; background: var(--blue-solid, #0d66e0); color: #fff; cursor: pointer;
}
.pbc-send:disabled { opacity: .5; cursor: default; }
.pbc-send svg { width: 20px; height: 20px; fill: currentColor; }

.pbc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 12px; }
.pbc-foot .pbc-wa {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--green-wa-dark, #15873f); color: #fff; font-weight: 700; font-size: .9rem; text-decoration: none;
}
.pbc-wa svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.pbc-new {
  min-height: 40px; padding: 0 10px; border: 0; background: none; cursor: pointer;
  color: var(--muted, #5d6a7f); font: 600 .85rem/1 var(--font, sans-serif); text-decoration: underline;
}

.pbc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .pbc-panel, .pbc-dots i, .pbc-bot, .pbc-launcher:hover .pbc-bot, .pbc-launcher:focus-visible .pbc-bot,
  .pbc-hello::after, .pbc-thinking .pbc-head img, .pbc-live { animation: none; }
  .pbc-launcher { transition: none; }
  .pbc-launcher:hover { transform: none; }
}
@media print { .pbc-launcher, .pbc-panel { display: none !important; } }
