/* ============================================================
   PAPER BIRDS — LIVE CHAT WIDGET
   ============================================================ */

/* ── FLOATING BUTTON ────────────────────────────────────────── */
.pb-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9800;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e060a0, #9040e0);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(224,96,160,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  color: #fff;
}
.pb-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 32px rgba(224,96,160,.55);
}
.pb-chat-btn svg { width: 26px; height: 26px; transition: transform .25s; }
.pb-chat-btn.open svg { transform: rotate(90deg); }

.pb-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #e04040;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: .68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  display: none;
}
.pb-chat-badge.show { display: flex; }

/* ── PANEL ──────────────────────────────────────────────────── */
.pb-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9799;
  width: 360px;
  max-height: 540px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(20,10,40,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .22s ease;
}
.pb-chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── PANEL HEADER ───────────────────────────────────────────── */
.pb-chat-hd {
  background: linear-gradient(135deg, #e060a0, #9040e0);
  padding: 18px 18px 14px;
  color: #fff;
  flex-shrink: 0;
}
.pb-chat-hd-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.pb-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.pb-chat-hd-info h4 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 2px;
}
.pb-chat-hd-info p {
  font-size: .72rem;
  opacity: .85;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.pb-chat-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #80ff80;
  box-shadow: 0 0 6px #80ff80;
  flex-shrink: 0;
}

/* ── MESSAGES AREA ──────────────────────────────────────────── */
.pb-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #e8e4f4 transparent;
  min-height: 0;
}
.pb-chat-msgs:empty::after {
  content: 'No messages yet. Say hello! 👋';
  color: #aaa8c0;
  font-size: .8rem;
  text-align: center;
  margin: auto;
  display: block;
  padding: 20px 0;
}

/* ── MESSAGE BUBBLES ────────────────────────────────────────── */
.pb-msg {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: pbMsgIn .2s ease forwards;
}
@keyframes pbMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pb-msg.customer { align-self: flex-end; flex-direction: row-reverse; }
.pb-msg.admin    { align-self: flex-start; }
.pb-msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: .84rem;
  line-height: 1.45;
  word-break: break-word;
}
.pb-msg.customer .pb-msg-bubble {
  background: linear-gradient(135deg, #e060a0, #9040e0);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.pb-msg.admin .pb-msg-bubble {
  background: #f3f0fa;
  color: #1a1825;
  border-bottom-left-radius: 4px;
}
.pb-msg-time {
  font-size: .64rem;
  color: #aaa8c0;
  margin-top: 3px;
  text-align: right;
}
.pb-msg.admin .pb-msg-time { text-align: left; }
.pb-msg-mini-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e060a0, #9040e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: #fff;
  flex-shrink: 0;
  align-self: flex-end;
}

/* ── TYPING INDICATOR ───────────────────────────────────────── */
.pb-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  background: #f3f0fa;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.pb-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c0a0d8;
  animation: pbDot .9s infinite ease-in-out;
}
.pb-typing span:nth-child(2) { animation-delay: .15s; }
.pb-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes pbDot {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* ── SUGGESTION CHIPS ───────────────────────────────────────── */
.pb-chips {
  padding: 6px 14px 4px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.pb-chips::-webkit-scrollbar { display: none; }
.pb-chip {
  white-space: nowrap;
  padding: 6px 13px;
  border: 1.5px solid #e060a0;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  color: #e060a0;
  background: #fff5fb;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
}
.pb-chip:hover { background: #e060a0; color: #fff; }

/* ── INPUT AREA ─────────────────────────────────────────────── */
.pb-chat-foot {
  padding: 10px 12px 14px;
  border-top: 1px solid #f0eef8;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.pb-chat-input {
  flex: 1;
  border: 1.5px solid #e8e4f4;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: .84rem;
  font-family: 'Inter', sans-serif;
  color: #1a1825;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color .15s;
}
.pb-chat-input:focus { border-color: #e060a0; }
.pb-chat-input::placeholder { color: #aaa8c0; }
.pb-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e060a0, #9040e0);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform .15s, opacity .15s;
  color: #fff;
}
.pb-send-btn:hover { transform: scale(1.08); }
.pb-send-btn:disabled { opacity: .5; cursor: default; }
.pb-send-btn svg { width: 18px; height: 18px; }

/* ── WELCOME MESSAGE ────────────────────────────────────────── */
.pb-chat-welcome {
  background: linear-gradient(135deg, #fdf0f8, #f3eeff);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .8rem;
  color: #7a5890;
  line-height: 1.5;
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  .pb-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 90px;
  }
  .pb-chat-btn { right: 18px; bottom: 20px; }
}
