/* ── Floating button ── */
#floatingChatBtn {
  position: fixed; bottom: 24px; right: 24px; z-index: 99998;
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 20px 0 14px;
  border-radius: 30px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #67271d, #843d32);
  color: #fff; font-weight: 600; font-size: 13px;
  font-family: 'Manrope', sans-serif;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(103,39,29,0.45);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease;
  transform-origin: bottom right;
}
#floatingChatBtn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(103,39,29,0.55); }
#floatingChatBtn.chat-open { opacity: 0; pointer-events: none; transform: scale(0.5); }
.fcb_icon { font-size: 18px; line-height: 1; }

/* ── Overlay (no dark backdrop) ── */
#chatOverlay {
  display: none; position: fixed; inset: 0;
  background: transparent; z-index: 999999;
  pointer-events: none;
  align-items: flex-end; justify-content: flex-end;
  padding: 0 24px 24px 0;
}
#chatOverlay.active { display: flex; }

/* ── Panel ── */
#chatPanel {
  pointer-events: all; background: #fff; border-radius: 20px;
  width: 370px; height: calc(100vh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 16px 56px rgba(0,0,0,0.22);
  transform-origin: bottom right;
  animation: sw-expand 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes sw-expand {
  0%   { opacity: 0.6; transform: scale(0.09); border-radius: 30px; }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); border-radius: 20px; }
}

/* ── Panel header ── */
#chatPanelHeader {
  background: linear-gradient(130deg, #67271d 0%, #843d32 55%, #67271d 100%);
  padding: 16px 18px; display: flex; align-items: center; gap: 12px;
  border-radius: 20px 20px 0 0; min-height: 68px; flex-shrink: 0;
}
#chatAvatarWrap { position: relative; flex-shrink: 0; }
#chatAvatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #fff; border: 2px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 6px;
}
#chatAvatar img { width: 100%; height: 100%; object-fit: contain; }
#chatOnlineDot {
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px; background: #4ade80;
  border-radius: 50%; border: 2px solid #fff;
}
#chatHeaderText { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#chatPanelTitle { color: #fff; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#chatHeaderSub  { color: rgba(255,255,255,0.72); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#closeChatBtn {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.18s; line-height: 1;
}
#closeChatBtn:hover { background: rgba(103,39,29,0.6); }
#chatFrame { flex: 1; width: 100%; border: none; min-height: 0; }

/* ── Mobile ── */
@media (max-width: 600px) {
  #floatingChatBtn { bottom: 16px; right: 16px; }
  #chatOverlay { padding: 0 0 16px 0; align-items: flex-end; justify-content: center; }
  #chatPanel { width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; height: calc(100vh - 90px); transform-origin: bottom center; }
}
