/* PF Chat — mini-chat do assistente virtual (site público) */
:root { --pfc-navy: #071A2D; --pfc-gold: #C9A45C; --pfc-gold-d: #A8823A; }

.pf-chat-launcher {
  position: fixed;
  /* Empilhado ACIMA do botão do WhatsApp (56px + espaço), mesma coluna. */
  bottom: max(98px, calc(90px + env(safe-area-inset-bottom, 0px)));
  right: max(28px, calc(20px + env(safe-area-inset-right, 0px)));
  width: 56px; height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--pf-blue-deep, var(--pfc-navy));
  color: var(--pf-gold, var(--pfc-gold));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 800;
  box-shadow: 0 4px 16px rgba(7, 26, 45, .35);
  transition: transform .25s ease, box-shadow .25s ease;
}
.pf-chat-launcher:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(7, 26, 45, .45); }
/* No painel não há o botão do WhatsApp embaixo → fica no canto inferior. */
.pf-chat-on-panel .pf-chat-launcher { bottom: max(28px, calc(20px + env(safe-area-inset-bottom, 0px))); }
.pf-chat-launcher::after {
  content: "";
  position: absolute; top: 4px; right: 4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #25D366; border: 2px solid var(--pf-blue-deep, var(--pfc-navy));
}
.pf-chat-widget.pf-chat-open .pf-chat-launcher { opacity: 0; pointer-events: none; transform: scale(.6); }

.pf-chat-panel {
  position: fixed;
  bottom: max(28px, calc(20px + env(safe-area-inset-bottom, 0px)));
  right: max(28px, calc(20px + env(safe-area-inset-right, 0px)));
  width: 370px; max-width: calc(100vw - 36px);
  height: 540px; max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(7, 26, 45, .28);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 801;
  opacity: 0; transform: translateY(24px) scale(.98);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.22,1,.36,1);
}
.pf-chat-widget.pf-chat-open .pf-chat-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.pf-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 18px;
  background: linear-gradient(135deg, var(--pf-blue-deep, var(--pfc-navy)) 0%, #0d2c49 100%);
  color: #fff;
}
.pf-chat-header-info { display: flex; align-items: center; gap: 12px; }
.pf-chat-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--pf-gold, var(--pfc-gold)); color: var(--pf-blue-deep, var(--pfc-navy));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: .5px;
  font-family: var(--pf-font-head, inherit);
}
.pf-chat-title { display: block; font-size: 14px; line-height: 1.2; }
.pf-chat-status { display: block; font-size: 11px; opacity: .8; }
.pf-chat-close {
  background: none; border: none; color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer; opacity: .85; padding: 0 4px;
}
.pf-chat-close:hover { opacity: 1; }

.pf-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: #f6f8fa;
}
.pf-chat-msg {
  max-width: 84%; padding: 10px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.pf-chat-msg.bot {
  align-self: flex-start; background: #fff; color: #1f2937;
  border: 1px solid #e5e7eb; border-bottom-left-radius: 4px;
}
.pf-chat-msg.user {
  align-self: flex-end; background: var(--pf-blue-deep, var(--pfc-navy)); color: #fff;
  border-bottom-right-radius: 4px;
}
.pf-chat-msg.bot a { color: var(--pf-gold-dark, var(--pfc-gold-d)); font-weight: 600; text-decoration: underline; word-break: break-all; }
.pf-chat-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; }
.pf-chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #c0c7d0; animation: pfChatBlink 1.2s infinite both; }
.pf-chat-typing span:nth-child(2) { animation-delay: .2s; }
.pf-chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes pfChatBlink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.pf-chat-form {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid #eef1f4; background: #fff;
}
.pf-chat-input {
  flex: 1; border: 1px solid #d8dee6; border-radius: 22px;
  padding: 11px 16px; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.pf-chat-input:focus { border-color: var(--pf-gold, var(--pfc-gold)); }
.pf-chat-send {
  flex-shrink: 0; width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--pf-gold, var(--pfc-gold)); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
}
.pf-chat-send:hover { background: var(--pf-gold-dark, var(--pfc-gold-d)); transform: scale(1.05); }
.pf-chat-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

@media (max-width: 480px) {
  .pf-chat-panel {
    right: 12px; left: 12px; width: auto;
    bottom: 12px; height: auto; max-height: calc(100vh - 90px); top: 70px;
  }
  /* Empilhado acima do botão do WhatsApp também no mobile. */
  .pf-chat-launcher { bottom: max(86px, calc(74px + env(safe-area-inset-bottom, 0px))); right: max(20px, calc(12px + env(safe-area-inset-right, 0px))); }
  .pf-chat-on-panel .pf-chat-launcher { bottom: max(20px, calc(12px + env(safe-area-inset-bottom, 0px))); }
}
