/* ============================================================
   GRUPO VOCICAL — lead.css
   Botão flutuante "Vico" + modal de captação de lead.
   Depende dos tokens de base.css. Carregado em todas as páginas.
   ============================================================ */

/* ---------- Botão flutuante (FAB) ---------- */
.lead-fab {
  position: fixed; right: clamp(16px, 3vw, 26px); bottom: clamp(16px, 3vw, 26px);
  z-index: 9998;
  display: inline-flex; align-items: center; gap: 0;
  height: 64px; padding: 0;
  border-radius: 999px;
  background: var(--red);
  color: var(--white);
  box-shadow: 0 14px 34px -10px rgba(166, 3, 3, .55), 0 4px 12px -4px rgba(13, 13, 13, .4);
  transition: transform .25s var(--ease-weight), box-shadow .25s var(--ease-weight), background .2s;
}
.lead-fab:hover { background: var(--red-dark); transform: translateY(-2px); }
.lead-fab__ava {
  width: 64px; height: 64px; flex: 0 0 64px;
  border-radius: 50%; overflow: hidden;
  background: var(--ink);
  border: 2px solid rgba(255, 255, 255, .85);
  display: grid; place-items: center;
}
.lead-fab__ava img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; transform: scale(1.35); }
.lead-fab__dot {
  position: absolute; top: 6px; right: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: #22c55e; border: 2px solid var(--white);
}
/* Rótulo "Fale conosco" sempre visível ao lado do avatar do Vico (pedido do cliente:
   usuários não percebiam o botão só com o ícone). */
.lead-fab__label {
  max-width: 240px; overflow: hidden; white-space: nowrap;
  font-family: var(--font); font-weight: 700; font-size: .92rem; letter-spacing: -.01em;
  opacity: 1; padding: 0 20px 0 14px;
}

@media (max-width: 560px) {
  .lead-fab { height: 58px; }
  .lead-fab__ava { width: 58px; height: 58px; flex: 0 0 58px; }
  .lead-fab__label { font-size: .85rem; padding: 0 16px 0 12px; }
}

/* pulso sutil de atenção (respeitando reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
  .lead-fab::after {
    content: ""; position: absolute; inset: 0; border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(166, 3, 3, .5);
    animation: lead-pulse 3.2s var(--ease-weight) infinite;
  }
  @keyframes lead-pulse {
    0% { box-shadow: 0 0 0 0 rgba(166, 3, 3, .45); }
    70%, 100% { box-shadow: 0 0 0 16px rgba(166, 3, 3, 0); }
  }
}

/* O atributo [hidden] precisa vencer o display: das classes abaixo
   (senão modal/backdrop fechados e o botão WhatsApp continuam renderizados). */
.lead-modal[hidden], .lead-backdrop[hidden], .lead-wa[hidden] { display: none !important; }

/* ---------- Backdrop ---------- */
.lead-backdrop {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(13, 13, 13, .58);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .32s ease;
}
.lead-backdrop.on { opacity: 1; }

/* ---------- Modal ---------- */
.lead-modal {
  position: fixed; inset: 0; z-index: 99999;
  display: grid; place-items: center;
  padding: clamp(12px, 3vw, 28px);
  pointer-events: none;
}
.lead-card {
  position: relative; pointer-events: auto;
  width: 100%; max-width: 460px;
  max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(28px) scale(.9);
  /* abertura com leve "pop" (spring); fechamento reverte suave */
  transition: opacity .3s ease, transform .46s cubic-bezier(.2,.85,.28,1.12);
}
.lead-modal.on .lead-card { opacity: 1; transform: none; }

.lead-x {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--white); background: rgba(255, 255, 255, .12);
  transition: background .2s;
}
.lead-x:hover { background: rgba(255, 255, 255, .24); }
.lead-x svg { width: 18px; height: 18px; }

/* ---------- Faixa escura (Vico) ---------- */
.lead-head {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 20px clamp(18px, 5vw, 26px);
  background: var(--ink); color: var(--white);
}
.lead-head > * { position: relative; z-index: 1; }
.lead-head__ava {
  width: 60px; height: 60px; flex: 0 0 60px;
  border-radius: 50%; overflow: hidden;
  background: #000; border: 2.5px solid var(--red);
  display: grid; place-items: center;
}
.lead-head__ava img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transform: scale(1.32); }
.lead-head__hi {
  font-family: var(--display); font-weight: 400; letter-spacing: -.02em;
  font-size: 1.32rem; line-height: 1;
}
.lead-head__hi span { color: #ff5a5a; }
.lead-head__sub { font-size: .82rem; color: rgba(255, 255, 255, .68); margin-top: 4px; letter-spacing: .01em; }

/* ---------- Corpo ---------- */
.lead-body { padding: clamp(16px, 5vw, 24px); overflow-y: auto; }
.lead-intro { font-size: .92rem; color: #3a3a3a; line-height: 1.5; margin-bottom: 18px; }

.lead-fs { border: 0; padding: 0; margin: 0 0 16px; }
.lead-lbl {
  display: block;
  font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--charcoal); margin-bottom: 8px;
}

.lead-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lead-pill {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 12px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.lead-pill:hover { border-color: #c9c9c9; }
.lead-pill__ic { flex: 0 0 auto; color: var(--gray); display: grid; place-items: center; transition: color .18s; }
.lead-pill__ic svg { width: 22px; height: 22px; }
.lead-pill__tx { font-size: .86rem; font-weight: 600; line-height: 1.15; color: var(--charcoal); }
.lead-pill.on {
  border-color: var(--red);
  background: #fbeaea;
  box-shadow: inset 0 0 0 1px var(--red);
}
.lead-pill.on .lead-pill__ic { color: var(--red); }
.lead-pill.on .lead-pill__tx { color: var(--red-dark); }

.lead-field { margin-bottom: 12px; }
.lead-row { display: flex; gap: 10px; }
.lead-field--grow { flex: 1 1 auto; }
.lead-field--uf { flex: 0 0 84px; }

.lead-input {
  width: 100%; height: 46px; padding: 0 13px;
  font-family: var(--font); font-size: .95rem; color: var(--charcoal);
  background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s;
}
.lead-input::placeholder { color: #b3b3b3; }
.lead-input:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(166, 3, 3, .12); }
.lead-select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230d0d0d' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}

.lead-note { font-size: .74rem; color: var(--gray); line-height: 1.4; margin: 4px 0 16px; }

.lead-submit {
  width: 100%; height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font); font-weight: 800; font-size: 1rem; letter-spacing: -.01em;
  color: var(--white); background: var(--red);
  border-radius: 999px;
  transition: background .2s, transform .12s, opacity .2s;
}
.lead-submit svg { width: 20px; height: 20px; }
.lead-submit:not(:disabled):hover { background: var(--red-dark); }
.lead-submit:not(:disabled):active { transform: translateY(1px); }
.lead-submit:disabled { background: #d6cdcd; color: #fff; cursor: not-allowed; }

/* ---------- Sucesso ---------- */
.lead-success { display: none; padding: clamp(22px, 6vw, 34px) clamp(18px, 5vw, 26px); text-align: center; }
.lead-success.on { display: block; }
.lead-success__ic {
  width: 58px; height: 58px; margin: 0 auto 14px;
  display: grid; place-items: center; border-radius: 50%;
  color: #16a34a; background: #e7f6ec;
}
.lead-success__ic svg { width: 30px; height: 30px; }
.lead-success__h { font-family: var(--display); font-weight: 400; font-size: 1.5rem; letter-spacing: -.02em; margin-bottom: 8px; }
.lead-success__p { font-size: .92rem; color: #3a3a3a; line-height: 1.5; margin-bottom: 18px; }
.lead-wa {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 50px; padding: 0 24px; margin-bottom: 10px;
  font-family: var(--font); font-weight: 700; font-size: .96rem;
  color: var(--white); background: #22a24a; border-radius: 999px;
  transition: background .2s;
}
.lead-wa:hover { background: #1c8a3e; }
.lead-success__close {
  display: block; margin: 6px auto 0; padding: 8px 14px;
  font-size: .85rem; font-weight: 600; color: var(--gray);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Rodapé ---------- */
.lead-foot {
  padding: 12px; text-align: center;
  font-size: .74rem; color: var(--gray);
  border-top: 1px solid var(--line); background: var(--white);
}
.lead-foot b { color: var(--red); font-weight: 800; }

/* ---------- Instância inline (ex: página de contato) ---------- */
.lead-card--inline {
  position: static;
  width: 100%; max-width: none; max-height: none;
  opacity: 1; transform: none;
}
.lead-card--inline .lead-x { display: none; }
.lead-card--inline .lead-body { overflow: visible; }

/* ---------- Trava de scroll do body ---------- */
body.lead-open { overflow: hidden; }

/* ---------- Mobile: modal centralizado com respiro (não bottom-sheet) ----------
   Escopo em `.lead-modal .lead-card` para NÃO afetar a instância inline
   (#lead-inline, ex.: página de contato), que não fica dentro do modal. */
@media (max-width: 480px) {
  .lead-modal { place-items: center; padding: 14px; }
  .lead-modal .lead-card {
    max-width: 100%;
    max-height: calc(100dvh - 28px);
    border-radius: var(--radius);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .lead-card, .lead-backdrop, .lead-fab, .lead-fab__label { transition: none; }
  .lead-modal.on .lead-card { transform: none; }
}
