/**
 * chat-widget.css — giao diện bong bóng chat dùng chung (xem chat-widget.js).
 * Tự chọn màu/nền riêng, không phụ thuộc theme của trang host (sáng hay tối đều dùng
 * được) — mọi lớp đều tiền tố "pw-" (Posthub Widget) để tránh đụng CSS của trang host.
 */
.pw-root { all: initial; }
.pw-root * { box-sizing: border-box; font-family: "Segoe UI", Roboto, Arial, sans-serif; }

.pw-bubble {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #3a7bfd;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(58, 123, 253, 0.45);
  z-index: 999999;
  user-select: none;
}
.pw-bubble:hover { background: #5b93ff; }

.pw-unread-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff5b5b;
  border: 2px solid #fff;
}
.pw-unread-dot[hidden] { display: none !important; }

.pw-panel {
  position: fixed;
  right: 22px;
  bottom: 90px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 72vh;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
}
.pw-panel[hidden] { display: none !important; }

.pw-header {
  background: #3a7bfd;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}
.pw-close-btn {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 16px;
  padding: 0;
  cursor: pointer;
  opacity: 0.85;
}
.pw-close-btn:hover { opacity: 1; }

.pw-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.pw-body[hidden] { display: none !important; }

.pw-label { display: block; font-size: 12px; color: #6b7280; margin: 0 0 6px; }
.pw-input {
  width: 100%;
  background: #f6f7fb;
  border: 1px solid #e6e6ef;
  border-radius: 8px;
  color: #1f2430;
  font-size: 13.5px;
  padding: 9px 11px;
  margin-bottom: 12px;
  font-family: inherit;
}
.pw-input:focus { outline: none; border-color: #3a7bfd; background: #fff; }
.pw-textarea { resize: vertical; min-height: 64px; }

.pw-btn {
  background: #3a7bfd;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}
.pw-btn:hover { background: #2e63d6; }
.pw-btn:disabled { background: #b7c3d6; cursor: not-allowed; }

.pw-msg { font-size: 12.5px; color: #6b7280; margin-top: 8px; white-space: pre-wrap; }
.pw-closed-note { color: #b8860b; margin-top: 0; margin-bottom: 10px; }

.pw-conversation { padding-bottom: 12px; }
.pw-messages {
  flex: 1;
  min-height: 120px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.pw-msg-bubble {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.pw-msg-customer { align-self: flex-end; background: #3a7bfd; color: #fff; border-bottom-right-radius: 3px; }
.pw-msg-admin { align-self: flex-start; background: #eef1f6; color: #1f2430; border-bottom-left-radius: 3px; }

.pw-send-row { display: flex; gap: 8px; flex: 0 0 auto; }
.pw-send-input { margin-bottom: 0; flex: 1; }
.pw-send-btn { flex-shrink: 0; }

@media (max-width: 480px) {
  .pw-panel { right: 16px; left: 16px; width: auto; bottom: 84px; }
  .pw-bubble { right: 16px; bottom: 16px; }
}
