/* =====================================================================
   Atendimento com IA (só na home)
   Seção presa na tela (sticky), no mesmo esquema da timeline do Processo:
   o scroll vertical troca a tela "antes" (cliente esperando) pela "depois"
   (IA respondendo). No celular e com movimento reduzido não prende: mostra
   direto a conversa com a IA. Lógica em js/atendimento.js.
   ===================================================================== */

.atend-section { padding: 0; }
.atend-pin-wrap { position: relative; }
.atend-sticky {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; align-items: center;
  overflow: hidden;
  padding-top: 60px; /* respiro do header fixo */
}
.atend-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 80px;
  align-items: center;
}

.atend-kpis {
  display: flex; gap: 0;
  margin-top: 34px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  max-width: 480px;
}
.atend-kpi {
  flex: 1;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.atend-kpi:last-child { border-right: none; }
.atend-kpi strong {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
  background: var(--gold-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.atend-kpi span { font-size: 12.5px; color: var(--text-muted); }

.atend-visual {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  position: relative;
}
.atend-visual::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 520px; height: 520px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(101,148,240,0.16), transparent 66%);
  pointer-events: none;
}

/* ----- Etiqueta antes/depois (as duas no mesmo lugar, em crossfade) ----- */
.ad-tag-wrap { position: relative; height: 30px; width: 100%; }
.ad-tag {
  position: absolute; top: 0; left: 0; right: 0;
  width: fit-content; margin: 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.ad-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ad-tag-bad { background: rgba(200,90,90,0.12); color: #e08b8b; }
.ad-tag-good { background: rgba(101,148,240,0.14); color: var(--gold-300); }

/* ----- Celular ----- */
.phone-frame {
  position: relative;
  /* cabe na altura da tela: o celular é 300x610 */
  width: min(290px, calc((100vh - 230px) * 300 / 610));
  min-width: 230px;
  aspect-ratio: 300 / 610;
  border-radius: 44px;
  background: linear-gradient(155deg, #24262b, #101114 60%);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    0 40px 90px -20px rgba(0,0,0,0.75),
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 0 60px -10px var(--gold-glow);
  padding: 10px;
}
.phone-notch {
  position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 34%; height: 22px;
  background: #050608;
  border-radius: 14px;
  z-index: 3;
}

/* Cores do WhatsApp de verdade (tema claro): exceção deliberada ao tema
   escuro da marca, porque o mockup é lido como um print do app. */
.phone-screen {
  position: absolute; inset: 10px;
  background: #efeae2;
  border-radius: 34px;
  overflow: hidden;
  display: flex; flex-direction: column;
  padding-top: 34px;
  font-family: -apple-system, 'Segoe UI', Roboto, 'Inter', sans-serif;
}
.phone-frame svg { width: 1em; height: 1em; }

.wa-statusbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px 6px;
  font-size: 10px; font-weight: 700;
  color: #111b21; background: #f7f8fa;
}
.phone-frame .wa-sb { width: 34px; height: 10px; }

.wa-header {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  background: #f7f8fa;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.wa-back { font-size: 13px; color: #54656f; display: flex; }
.wa-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--gold-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #06070a;
}
.wa-header-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-name { font-size: 12.5px; font-weight: 700; color: #111b21; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-status { font-size: 9px; color: #667781; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-online { width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: #25d366; }
.wa-header-icons { margin-left: auto; display: flex; gap: 13px; font-size: 13px; color: #54656f; }

.wa-body {
  flex: 1;
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.wa-body::-webkit-scrollbar { display: none; }

.wa-bubble {
  max-width: 82%;
  font-size: 10.5px; line-height: 1.4;
  padding: 7px 8px;
  border-radius: 8px;
  color: #111b21;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.wa-bubble.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 2px; }
.wa-bubble.out { align-self: flex-end; background: #d9fdd3; border-bottom-right-radius: 2px; }
.wa-bubble.fade { opacity: 0.45; }
.wa-bubble.enter { animation: wa-in .4s cubic-bezier(.22,1,.36,1) both; }
@keyframes wa-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.wa-body.leaving > * { opacity: 0; transition: opacity .35s ease; }

.wa-meta {
  float: right;
  display: inline-flex; align-items: center; gap: 3px;
  margin: 4px 0 -2px 8px;
  font-size: 8px; white-space: nowrap;
  color: #667781;
}
.wa-tick { color: #53bdeb; font-size: 9px; }

.wa-typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 8px; border-bottom-left-radius: 2px;
  padding: 9px 11px;
  display: flex; gap: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.wa-typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: #a6b1b8;
  animation: wa-dot 1.1s infinite ease-in-out;
}
.wa-typing span:nth-child(2) { animation-delay: .15s; }
.wa-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes wa-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.wa-sysmsg {
  align-self: center;
  font-size: 9.5px; font-weight: 600;
  color: #667781;
  background: rgba(255,255,255,0.6);
  padding: 4px 10px;
  border-radius: 8px;
}
.wa-sysmsg.bad { color: #c0392b; }
.wa-sysmsg.good { color: #2f8a5a; background: rgba(217,253,211,0.8); }

.wa-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 14px;
  background: #f7f8fa;
  font-size: 16px; color: #8696a0;
}
.wa-ico { display: flex; }
.wa-input-placeholder {
  flex: 1;
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 10px; color: #8696a0;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.wa-mic-btn {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  background: #25d366;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px;
}

/* ----- Barra de progresso do antes → depois ----- */
.ad-progress {
  width: min(290px, 78vw);
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.ad-progress-fill { height: 100%; width: 0%; background: var(--gold-gradient); }

/* estado inicial do crossfade (o JS controla a opacidade pelo scroll) */
.ad-fade-in { opacity: 0; }
.ad-fade-out { opacity: 1; }

/* ----- Sem pin: celular, movimento reduzido, telas baixas ----- */
.atend-pin-wrap.no-pin { height: auto !important; }
.atend-pin-wrap.no-pin .atend-sticky { position: static; height: auto; padding: 130px 0; overflow: visible; }
.atend-pin-wrap.no-pin .ad-fade-in { opacity: 1; }
.atend-pin-wrap.no-pin .ad-fade-out { display: none; }
.atend-pin-wrap.no-pin .ad-progress { display: none; }
.atend-pin-wrap.no-pin .phone-frame { width: 290px; }

@media (max-width: 960px) {
  .atend-grid { grid-template-columns: 1fr; gap: 56px; }
  .atend-visual::before { width: 380px; height: 380px; }
}
@media (max-width: 560px) {
  .atend-pin-wrap.no-pin .atend-sticky { padding: 90px 0; }
  .atend-pin-wrap.no-pin .phone-frame { width: min(270px, 78vw); }
  .atend-kpi { padding: 14px 12px; }
  .atend-kpi strong { font-size: 20px; }
  .atend-kpi span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .wa-bubble.enter, .wa-typing span { animation: none; }
}
