/* ==========================================================================
   whatsapp-chat.css — floating WhatsApp-style chat widget for DramaGo.
   Purely a visual/scripted clone of a WhatsApp conversation (no real
   WhatsApp connection except the final handoff link in "Falar com
   atendente"). Namespaced with "wac-" so it never collides with the rest
   of the page's CSS.
   ========================================================================== */

:root {
  --wac-green: #25d366;
  --wac-green-dark: #128c7e;
  --wac-teal-header: #148a71;
  --wac-bg: #e7ded1;
  --wac-bubble-in: #ffffff;
  --wac-bubble-out: #d9fdd3;
  --wac-text: #111b21;
  --wac-dim: #667781;
}

/* ---------- Floating button ---------- */
.wac-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9500;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--wac-green);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  transition: transform .15s ease;
}

.wac-fab:hover { transform: scale(1.06); }
.wac-fab svg { width: 32px; height: 32px; }

.wac-fab-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: wacPing 2.2s cubic-bezier(0, 0, .2, 1) infinite;
  background: var(--wac-green);
  opacity: .55;
}

@keyframes wacPing {
  0% { transform: scale(1); opacity: .55; }
  100% { transform: scale(1.7); opacity: 0; }
}

.wac-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #0c0c14;
}

/* ---------- Panel ---------- */
.wac-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9500;
  width: 380px;
  height: min(640px, 88vh);
  background: var(--wac-bg);
  border-radius: 14px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.wac-panel.open { display: flex; }

@media (max-width: 480px) {
  .wac-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
  .wac-fab { right: 14px; bottom: 14px; }
}

/* ---------- Header ---------- */
.wac-header {
  background: var(--wac-teal-header);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex-shrink: 0;
}

.wac-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.wac-avatar img { width: 100%; height: 100%; object-fit: cover; }

.wac-header-info { flex: 1; min-width: 0; }
.wac-header-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.wac-header-status { font-size: 12px; opacity: .85; line-height: 1.3; }

.wac-header-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  display: grid;
  place-items: center;
  opacity: .9;
}
.wac-header-close:hover { opacity: 1; }
.wac-header-close svg { width: 20px; height: 20px; }

/* ---------- Message area ---------- */
.wac-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 8px;
  background-color: var(--wac-bg);
  background-image:
    radial-gradient(circle at 8px 8px, rgba(0,0,0,.05) 1.5px, transparent 1.6px),
    radial-gradient(circle at 34px 46px, rgba(0,0,0,.045) 2px, transparent 2.1px);
  background-size: 64px 64px, 90px 90px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wac-date-pill {
  align-self: center;
  background: rgba(255, 255, 255, .85);
  color: var(--wac-dim);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  margin: 4px 0 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.wac-row { display: flex; margin: 3px 0; }
.wac-row.in { justify-content: flex-start; }
.wac-row.out { justify-content: flex-end; }

.wac-bubble {
  max-width: 82%;
  padding: 8px 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  position: relative;
  box-shadow: 0 1px 1.5px rgba(0,0,0,.15);
}

.wac-row.in .wac-bubble {
  background: var(--wac-bubble-in);
  color: var(--wac-text);
  border-top-left-radius: 2px;
}

.wac-row.out .wac-bubble {
  background: var(--wac-bubble-out);
  color: var(--wac-text);
  border-top-right-radius: 2px;
}

.wac-bubble b, .wac-bubble strong { font-weight: 700; }
.wac-bubble em { font-style: italic; }

.wac-time {
  position: absolute;
  right: 10px;
  bottom: 5px;
  font-size: 10.5px;
  color: var(--wac-dim);
}

.wac-typing {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
}
.wac-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9aa0a6;
  animation: wacTyping 1.1s infinite ease-in-out;
}
.wac-typing span:nth-child(2) { animation-delay: .15s; }
.wac-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes wacTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Options / list UI ---------- */
.wac-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 12px;
  max-width: 90%;
}

.wac-opt-btn {
  background: #fff;
  border: 1px solid #d8dee3;
  color: var(--wac-green-dark);
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 20px;
  padding: 9px 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.wac-opt-btn:hover { background: #f6faf8; }

.wac-list-trigger {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: none;
  color: #34a4eb;
  font-weight: 700;
  font-size: 14px;
  border-radius: 22px;
  padding: 11px 18px;
  margin: 4px 0 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.wac-list-trigger svg { width: 17px; height: 17px; }

/* Bottom sheet for "list" style options */
.wac-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  display: none;
  z-index: 5;
}
.wac-sheet-backdrop.open { display: block; }

.wac-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 8px 0 4px;
  transform: translateY(100%);
  transition: transform .22s ease;
  z-index: 6;
  max-height: 70%;
  display: flex;
  flex-direction: column;
}
.wac-sheet.open { transform: translateY(0); }

.wac-sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: #d8dee3; margin: 6px auto 10px;
}

.wac-sheet-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--wac-text);
  padding: 0 18px 8px;
  border-bottom: 1px solid #eee;
}

.wac-sheet-list { overflow-y: auto; padding: 4px 0; }

.wac-sheet-item {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 13px 18px;
  font-size: 14.5px;
  color: var(--wac-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wac-sheet-item:hover { background: #f5f6f6; }
.wac-sheet-item + .wac-sheet-item { border-top: 1px solid #f0f0f0; }

/* ---------- Payment button ---------- */
.wac-pay-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--wac-green);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: none;
  border-radius: 22px;
  padding: 11px 20px;
  margin: 4px 0 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 211, 102, .4);
}
.wac-pay-btn svg { width: 16px; height: 16px; }

/* ---------- Lead form (Falar com atendente) ---------- */
.wac-form {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin: 4px 0 12px;
  max-width: 92%;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wac-form input {
  border: 1px solid #d8dee3;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.wac-form input:focus { border-color: var(--wac-green-dark); }
.wac-form-submit {
  background: var(--wac-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}

/* ---------- Composer ---------- */
.wac-composer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f0f0f0;
}
.wac-composer input {
  flex: 1;
  border: none;
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.wac-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--wac-green);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.wac-send-btn svg { width: 19px; height: 19px; }
