/* ═══════════════════════════════════════════════════
   CHAT WIDGET — Pizzaria do Rocha
   Botão flutuante de ajuda suspenso (bottom-right)
   ═══════════════════════════════════════════════════ */

.chat-widget {
  position: fixed;
  bottom: 148px;
  right: 24px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
  transition:
    opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s 0.55s;
}
.chat-widget.chat-ready {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition:
    opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s 0s;
}

/* Pulse de atenção — apenas pós-reveal e FINITO (não fica piscando o site todo) */
.chat-widget-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(232, 67, 47, 0.55);
  animation: none;
  pointer-events: none;
}
.chat-widget.chat-ready .chat-widget-fab::after {
  animation: chatPulse 2.6s cubic-bezier(0.16, 1, 0.3, 1) 2 forwards;
  animation-delay: 0.6s;
}
@keyframes chatPulse {
  0%   { transform: scale(1); opacity: 0.75; }
  70%  { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

.chat-widget-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8432f 0%, #c53321 100%);
  color: #f4ede1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(232, 67, 47, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.chat-widget-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(232, 67, 47, 0.5);
}
.chat-widget-fab .chat-widget-fab-close { display: none; }
.chat-widget-fab.open .chat-widget-fab-open { display: none; }
.chat-widget-fab.open .chat-widget-fab-close { display: block; }

/* Com o painel aberto o FAB fica oculto (o × do cabeçalho fecha o chat) —
   evita o botão "vazando" por trás do canto inferior direito do painel */
.chat-widget.open .chat-widget-fab {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.82);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.2s;
}
.chat-widget.open .chat-widget-fab::after { animation: none; }

.chat-widget-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff9800;
  color: #fff;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ── Painel do Chat ── */
.chat-widget-panel {
  position: fixed;
  bottom: 216px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 240px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transform-origin: bottom right;
}
@keyframes chatPanelIn {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-widget-header {
  background: linear-gradient(135deg, #7a1f1a 0%, #e8432f 100%);
  color: #f4ede1;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-widget-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.chat-widget-title {
  font-weight: 800;
  font-size: 15px;
}
.chat-widget-subtitle {
  font-size: 11px;
  opacity: 0.85;
}

.chat-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: #faf6ef;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-widget-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
}
.chat-widget-msg.bot {
  background: #fff;
  border: 1px solid #eedfcb;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  color: #1a1210;
}
.chat-widget-msg.user {
  background: linear-gradient(135deg, #e8432f 0%, #c53321 100%);
  color: #f4ede1;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.chat-widget-msg.admin {
  background: #fff8e1;
  border: 1px solid #ffd54f;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  color: #1a1210;
}

.chat-widget-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eedfcb;
  background: #fff;
}
.chat-widget-inputbar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d9cbb3;
  border-radius: 20px;
  font-size: 14px;
  box-sizing: border-box;
  background: #faf6ef;
  outline: none;
}
.chat-widget-inputbar input:focus {
  border-color: #e8432f;
}
.chat-widget-inputbar button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8432f 0%, #c53321 100%);
  color: #f4ede1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.chat-widget-inputbar button:hover {
  transform: scale(1.08);
}

/* ── Botão de pagamento (PIX via InfinitePay) ── */
.chat-pay-wrap {
  margin-top: 8px;
  text-align: left;
}
.chat-pay-btn {
  display: inline-block;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #2ba84a 0%, #1f8a3d 100%);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(47, 168, 90, 0.4);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s, filter 0.2s;
}

/* ── Boas-Vindas & Chips de Comandos Awwwards ── */
.chat-widget-msg.chat-welcome-msg {
  max-width: 96%;
  padding: 0;
  background: transparent;
  border: none;
}
.chat-welcome-card {
  background: linear-gradient(145deg, #ffffff 0%, #faf3eb 100%);
  border: 1px solid #eedfcb;
  border-radius: 14px;
  padding: 13px 13px 11px;
  box-shadow: 0 4px 16px rgba(122, 31, 26, 0.06);
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: #2b1810;
}
.chat-welcome-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.chat-welcome-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #edf7ed;
  color: #1e4620;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #c8e6c9;
}
.chat-welcome-tag .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2e7d32;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.25);
  animation: liveDot 1.6s infinite;
}
@keyframes liveDot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}
.chat-welcome-text {
  font-size: 13px;
  line-height: 1.45;
  color: #3b2820;
}
.chat-commands-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8c6d58;
  margin-top: 1px;
}
.chat-commands-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-command-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #e2d1bc;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #7a1f1a;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.chat-command-chip:hover {
  background: linear-gradient(135deg, #e8432f 0%, #c53321 100%);
  color: #ffffff;
  border-color: #c53321;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 14px rgba(232, 67, 47, 0.28);
}
.chat-command-chip:active {
  transform: translateY(0) scale(0.97);
}
.chat-command-chip code {
  font-family: inherit;
  font-size: 11px;
  opacity: 0.9;
}
.chat-pay-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(47, 168, 90, 0.5);
}
.chat-pay-btn:active {
  transform: translateY(0) scale(0.97);
}
.chat-pay-btn:disabled {
  opacity: 0.75;
  cursor: wait;
  filter: saturate(0.7);
}
.chat-pay-btn.ready {
  background: linear-gradient(135deg, #7a1f1a 0%, #c53321 100%);
}

/* ── Responsivo Mobile ── */
@media (max-width: 480px) {
  .chat-widget-panel {
    bottom: 212px;
    right: 12px;
    width: calc(100vw - 24px);
    height: 62vh;
    max-height: calc(100vh - 230px);
  }
  .chat-widget {
    bottom: 148px;
    right: 16px;
  }
  .chat-widget-fab {
    width: 54px;
    height: 54px;
  }
}

/* ── Animações ── */
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-widget-panel {
  animation: chatFadeIn 0.25s ease-out;
}
.chat-widget-msg {
  animation: chatFadeIn 0.2s ease-out;
}

/* ── Desktop: FAB acima do botão WhatsApp flutuante (wa-float bottom:24px, ~54px) ── */
@media (min-width: 881px) {
  .chat-widget {
    bottom: 96px;
    right: 24px;
  }
}
