/* ================================
   Overlay (cobre a viewport inteira)
   ================================ */
.wa-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease;
  z-index: 999998; /* acima do conteúdo do site */
  pointer-events: none; /* evita clique quando fechado */
}
.wa-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ================================
   Modal (desktop/tablet: canto inferior direito)
   mobile: bottom-sheet ocupando ~70% da altura
   ================================ */
.wa-modal {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(520px, 92vw);
  max-height: 85dvh;             /* altura segura em desktop/tablet */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,.22);
  padding: 20px 18px 18px;
  color: #333;
  z-index: 999999;               /* acima do overlay e botões flutuantes */

  /* anima de baixo pra cima no desktop/tablet */
  transform: translateY(16px);
  opacity: 0;
  visibility: hidden;
  transition: transform .22s ease, opacity .22s ease, visibility 0s linear .22s;
  overflow: auto;                /* rolagem interna se precisar */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Estado aberto */
.wa-modal.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  transition: transform .22s ease, opacity .22s ease;
}

/* ================================
   Mobile: vira bottom-sheet
   ================================ */
@media (max-width: 640px) {
  .wa-modal {
    right: 0; left: 0; bottom: 0;
    width: 100vw;
    height: 70dvh;               /* ~70% da altura visível (iOS-safe) */
    max-height: 80svh;           /* fallback compatível */
    border-radius: 18px 18px 0 0;/* cantos superiores arredondados */
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    /* anima como bottom-sheet subindo do rodapé */
    transform: translateY(8%);
  }
  .wa-modal.open {
    transform: translateY(0);
  }
}

/* Reduz animações se o usuário preferir */
@media (prefers-reduced-motion: reduce) {
  .wa-overlay,
  .wa-modal {
    transition: none;
  }
}

/* ================================
   Botão Fechar sempre visível (sticky)
   ================================ */
.wa-close {
  position: sticky;   /* gruda no topo quando rolar */
  top: 8px;
  float: right;       /* alinha à direita sem wrapper extra */
  z-index: 1;

  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff7e3cc;       /* leve transparência */
  backdrop-filter: blur(4px);  /* destaca sobre conteúdo */
  color: #333;
  font-size: 20px;
  cursor: pointer;
}

/* Faixa “topbar” sutil sob o botão, para contraste ao rolar */
.wa-modal::before {
  content: "";
  position: sticky;
  top: 0;
  display: block;
  height: 8px;                /* espessura mínima para disparar sticky */
  margin-bottom: 4px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0));
  z-index: 0;
}

/* ================================
   Conteúdo
   ================================ */
.wa-title {
  margin: 6px 6px 2px;
  font-weight: 700;
  font-size: 1.25rem;
  color: #2d2d2d;
}

.wa-desc {
  margin: 0 6px 14px;
  color: #5a5a5a;
  font-size: .95rem;
}

.wa-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 6px;
}

.wa-field label {
  font-size: .9rem;
  color: #444;
}

.wa-field input,
.wa-field select {
  border: 1px solid #e6e2d6;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  font-size: .98rem;
  transition: border-color .15s ease, box-shadow .15s ease;
  background: #fff;
}

.wa-field input:focus,
.wa-field select:focus {
  border-color: #f3c25a;                   /* mostarda */
  box-shadow: 0 0 0 3px rgba(243,194,90,.25);
}

.wa-error {
  min-height: 16px;
  color: #b42318;
  font-size: .8rem;
}

.wa-button {
  display: inline-block;
  margin: 10px 6px 0;
  padding: 12px 16px;
  background: #f3c25a;                     /* mostarda */
  color: #1d1d1d;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s ease, transform .02s ease, opacity .15s ease;
}

.wa-button:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.wa-button:active {
  transform: translateY(1px);
}

.wa-privacy {
  font-size: .8rem;
  color: #666;
  margin: 8px 6px 0;
}

.wa-link {
  background: none;
  border: none;
  color: #a67c00;                           /* tom do tema */
  text-decoration: underline;
  cursor: pointer;
  padding: 0 2px;
  font-size: .8rem;
}
