/* ==========================================================
   Rogacionista - WhatsApp Flow (chat de cadastro)
   ========================================================== */
:root {
  --waf-red: #980101;
  --waf-red-dark: #6e0000;
  --waf-yellow: #ffcb05;
  --waf-green: #25d366;
  --waf-green-dark: #128c7e;
  --waf-bg: #efeae2;
  --waf-bubble-in: #ffffff;
  --waf-bubble-out: #d9fdd3;
  --waf-text: #1f2c34;
  --waf-muted: #667781;
  --waf-radius: 18px;
  --waf-shadow: 0 20px 60px rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .12);
}

.waf-root, .waf-root * { box-sizing: border-box; font-family: 'Nunito', 'Muli', system-ui, sans-serif; }

/* Evita sobreposição com a seta "voltar ao topo" do Mobirise */
#scrollToTop.mbr-arrow-up { right: 27px !important; bottom: 100px !important; }

/* Substitui o widget antigo de WhatsApp das unidades (link direto) pelo flow */
.bt-whatsApp, #alertWapp, #msg1 { display: none !important; }

/* ---------- Botão flutuante ---------- */
.waf-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 99998;
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(145deg, #2fe078, var(--waf-green-dark));
  box-shadow: 0 10px 25px rgba(18, 140, 126, .45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease;
}
.waf-fab:hover { transform: scale(1.08) rotate(-4deg); box-shadow: 0 14px 32px rgba(18, 140, 126, .55); }
.waf-fab svg { width: 34px; height: 34px; fill: #fff; }
.waf-fab::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--waf-green); animation: waf-pulse 2.2s ease-out infinite;
}
.waf-fab .waf-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--waf-red); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.waf-root.is-open .waf-fab::before, .waf-root.is-open .waf-badge { display: none; }

@keyframes waf-pulse {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- Teaser ---------- */
.waf-teaser {
  position: fixed; right: 96px; bottom: 34px; z-index: 99997; max-width: 250px;
  background: #fff; color: var(--waf-text); padding: 12px 34px 12px 14px; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); font-size: 14px; line-height: 1.35; cursor: pointer;
  opacity: 0; transform: translateY(10px) scale(.96); pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.waf-teaser strong { color: var(--waf-red); }
.waf-teaser.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.waf-teaser-close {
  position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 18px;
  line-height: 1; color: var(--waf-muted); cursor: pointer;
}

/* ---------- Janela do chat ---------- */
.waf-window {
  position: fixed; right: 22px; bottom: 100px; z-index: 99999;
  width: 380px; max-width: calc(100vw - 24px); height: 600px; max-height: calc(100vh - 130px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--waf-radius); background: var(--waf-bg); box-shadow: var(--waf-shadow);
  opacity: 0; transform: translateY(24px) scale(.95); transform-origin: bottom right; pointer-events: none;
  transition: opacity .3s ease, transform .3s cubic-bezier(.2, .9, .3, 1.2);
}
.waf-root.is-open .waf-window { opacity: 1; transform: none; pointer-events: auto; }

.waf-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: linear-gradient(135deg, var(--waf-red) 0%, var(--waf-red-dark) 100%); color: #fff;
}
.waf-avatar {
  position: relative; width: 44px; height: 44px; border-radius: 50%; background: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.waf-avatar img { width: 100%; height: 100%; object-fit: contain; }
.waf-avatar::after {
  content: ''; position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--waf-green); border: 2px solid var(--waf-red);
}
.waf-header-info { flex: 1; min-width: 0; }
.waf-header-title { font-weight: 800; font-size: 16px; line-height: 1.2; }
.waf-header-sub { font-size: 12.5px; opacity: .85; }
.waf-header button {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.waf-header button:hover { background: rgba(255, 255, 255, .25); }

.waf-progress { height: 3px; background: rgba(152, 1, 1, .15); }
.waf-progress span { display: block; height: 100%; width: 0; background: var(--waf-yellow); transition: width .4s ease; }

.waf-body {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px; scroll-behavior: smooth;
  background-color: var(--waf-bg);
  background-image: radial-gradient(rgba(152, 1, 1, .06) 1px, transparent 1px);
  background-size: 18px 18px;
}
.waf-body::-webkit-scrollbar { width: 6px; }
.waf-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .15); border-radius: 3px; }

.waf-msg {
  max-width: 85%; margin-bottom: 8px; padding: 8px 12px 18px; position: relative;
  font-size: 14.5px; line-height: 1.4; color: var(--waf-text); word-wrap: break-word;
  border-radius: 10px; box-shadow: 0 1px .5px rgba(0, 0, 0, .13);
  animation: waf-in .3s ease both;
}
.waf-msg time { position: absolute; right: 9px; bottom: 3px; font-size: 10.5px; color: var(--waf-muted); }
.waf-msg.bot { background: var(--waf-bubble-in); border-top-left-radius: 2px; }
.waf-msg.user { background: var(--waf-bubble-out); margin-left: auto; border-top-right-radius: 2px; }
.waf-msg.user time::after { content: ' ✓✓'; color: #53bdeb; }
.waf-msg strong { color: var(--waf-red); }
.waf-summary { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13.5px; }
.waf-summary li { padding: 3px 0; border-bottom: 1px dashed rgba(0, 0, 0, .08); }
.waf-summary li:last-child { border: 0; }
.waf-summary b { color: var(--waf-muted); font-weight: 700; }

@keyframes waf-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

.waf-typing { display: inline-flex; gap: 4px; padding: 12px 14px; background: #fff; border-radius: 10px; border-top-left-radius: 2px; margin-bottom: 8px; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); }
.waf-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa5ab; animation: waf-dot 1.2s infinite ease-in-out; }
.waf-typing i:nth-child(2) { animation-delay: .15s; }
.waf-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes waf-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- Opções ---------- */
.waf-options { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 4px 0 10px; animation: waf-in .3s ease both; }
.waf-options.is-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.waf-opt {
  border: 1.5px solid var(--waf-red); background: #fff; color: var(--waf-red);
  padding: 9px 14px; border-radius: 22px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .2s, color .2s, transform .15s; text-align: center;
}
.waf-opt:hover { background: var(--waf-red); color: #fff; transform: translateY(-1px); }
.waf-opt.is-primary { background: var(--waf-green-dark); border-color: var(--waf-green-dark); color: #fff; }
.waf-opt.is-primary:hover { background: #0e7268; }
.waf-opt-group { grid-column: 1 / -1; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--waf-muted); margin-top: 4px; text-align: right; }
.waf-opt.is-suggested {
  background: var(--waf-yellow); border-color: var(--waf-yellow); color: var(--waf-red-dark);
  box-shadow: 0 4px 12px rgba(255, 203, 5, .45); animation: waf-glow 1.8s ease-in-out infinite;
}
.waf-opt.is-suggested:hover { background: var(--waf-red); border-color: var(--waf-red); color: #fff; animation: none; }
.waf-opt.is-full { grid-column: 1 / -1; }
.waf-opt.is-ghost { border-style: dashed; border-color: var(--waf-muted); color: var(--waf-muted); background: transparent; font-weight: 700; }
.waf-opt.is-ghost:hover { background: #fff; color: var(--waf-red); border-color: var(--waf-red); }
@keyframes waf-glow { 0%, 100% { box-shadow: 0 4px 12px rgba(255, 203, 5, .35); } 50% { box-shadow: 0 4px 18px rgba(255, 203, 5, .8); } }

/* ---------- Input ---------- */
.waf-footer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 12px; background: #f0f2f5; }
.waf-input {
  flex: 1; border: 0; outline: none; resize: none; border-radius: 22px; padding: 11px 16px;
  font-size: 15px; background: #fff; color: var(--waf-text); max-height: 110px; min-height: 44px; line-height: 1.35;
}
.waf-input:disabled { background: #e9ecef; cursor: not-allowed; }
.waf-input.is-error { box-shadow: 0 0 0 2px #e53935; animation: waf-shake .35s; }
@keyframes waf-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.waf-send {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex-shrink: 0;
  background: var(--waf-green-dark); display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .2s;
}
.waf-send:hover:not(:disabled) { transform: scale(1.06); background: #0e7268; }
.waf-send:disabled { background: #b0bec5; cursor: not-allowed; }
.waf-send svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.waf-skip { border: 0; background: none; color: var(--waf-green-dark); font-weight: 800; font-size: 13px; cursor: pointer; padding: 0 4px 12px; display: none; }
.waf-skip.is-visible { display: block; }
.waf-error-text { font-size: 12px; color: #e53935; padding: 0 18px 6px; background: #f0f2f5; display: none; }
.waf-error-text.is-visible { display: block; }

.waf-lgpd { font-size: 10.5px; color: var(--waf-muted); text-align: center; padding: 0 12px 8px; background: #f0f2f5; }
.waf-lgpd a { color: var(--waf-muted); text-decoration: underline; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .waf-window { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; }
  .waf-root.is-open .waf-fab { display: none; }
  .waf-teaser { right: 90px; bottom: 30px; max-width: 200px; }
  .waf-fab { right: 16px; bottom: 16px; }
}
