/**
 * Dock de ação: "Inscreva-se já!" + WhatsApp (floating-cta.php, js/acao-dock.js).
 *
 * Só no mobile (< 768px). No desktop o wrapper vira display: contents e os dois botões seguem o css/floating-cta.css
 * (position: fixed, pulso etc.).
 *
 * Os seletores do mobile usam "html body .acao-dock" para vencer o css/floating-cta.css e as regras de
 * .whatsapp-float das páginas de curso (carregadas depois dele), sem !important.
 */

/* ---------- Ícone do WhatsApp (todas as larguras) ---------- */
/* Substitui o PNG de 30 x 30 px: mesmo tamanho e cor branca sobre o círculo verde. */
.acao-dock .whatsapp-float > .fa-whatsapp {
  display: block;
  color: #fff;
  font-size: 30px;
  line-height: 1;
}

/* ---------- Desktop (>= 768px): nada muda ---------- */
@media (min-width: 768px) {
  .acao-dock {
    display: contents;
  }

  /* Ícone e seta existem só na dock do mobile. */
  .acao-dock .subscribe-anchor-floating > i {
    display: none;
  }
}

/* ---------- Mobile (< 768px) ---------- */
@media (max-width: 767.98px) {
  @keyframes acao-dock-brilho {
    0% {
      transform: translateX(-150%) skewX(-20deg);
    }
    /* 0,9 s de 8 s */
    11.25%,
    100% {
      transform: translateX(450%) skewX(-20deg);
    }
  }

  .acao-dock,
  /* /inscreva-se: inscricao-rapida.css põe position: relative e z-index: 1 em todo filho direto do body (0,3,1). */
  body.landing-inscricao-rapida > .acao-dock.acao-dock:not(.modal):not(.modal-backdrop) {
    position: fixed;
    left: auto;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    box-sizing: border-box;
    z-index: 1035;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    border: 1px solid rgba(18, 3, 99, 0.08);
    box-shadow: 0 16px 40px -12px rgba(28, 26, 74, 0.35);
  }

  /* Só o WhatsApp (show_subscribe = false): a dock encolhe ao círculo, no canto direito. */
  .acao-dock.acao-dock--so-whats,
  body.landing-inscricao-rapida > .acao-dock.acao-dock.acao-dock--so-whats:not(.modal):not(.modal-backdrop) {
    width: auto;
  }

  /* CTA oculto (topo ou seção redundante na tela): mesmo círculo de "só WhatsApp" (52px + 16px padding + 2px borda),
     com largura numérica para transicionar sem salto mantendo o WhatsApp fixo à direita. */
  .acao-dock.is-cta-oculta:not(.acao-dock--so-whats),
  body.landing-inscricao-rapida > .acao-dock.acao-dock.is-cta-oculta:not(.acao-dock--so-whats):not(.modal):not(.modal-backdrop) {
    width: 70px;
    gap: 0;
  }

  .acao-dock.is-cta-oculta:not(:has(.whatsapp-float)) {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }

  /* Estados (js/acao-dock.js). A transição só liga depois da primeira avaliação (.is-pronta), para a dock
     não "deslizar para fora" ao carregar a página. */
  .acao-dock.is-pronta {
    transition:
      transform 0.3s ease,
      opacity 0.3s ease,
      width 0.3s ease,
      gap 0.3s ease;
  }

  .acao-dock.is-pronta .subscribe-anchor-floating {
    transition:
      opacity 0.3s ease,
      padding 0.3s ease;
  }

  .acao-dock.is-oculta,
  .acao-dock.is-recolhida {
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
  }

  /* ----- CTA ----- */
  html body .acao-dock .subscribe-anchor-floating {
    /* relative (sem deslocamento) no lugar de static: o ::before do brilho se posiciona em relação ao botão. */
    position: relative;
    inset: auto;
    z-index: auto;
    flex: 1;
    min-width: 0;
    height: 52px;
    min-height: 52px;
    margin: 0;
    padding: 0 18px;
    overflow: hidden;
    white-space: nowrap;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    background: var(--ui-yellow, #ffcf00);
    color: var(--ui-navy, #120363);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: none;
    text-decoration: none;
    animation: none;
    box-shadow: none;
  }

  html body .acao-dock.is-cta-oculta .subscribe-anchor-floating {
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    pointer-events: none;
  }

  .acao-dock .subscribe-anchor-floating > span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html body .acao-dock .subscribe-anchor-floating:hover,
  html body .acao-dock .subscribe-anchor-floating:focus,
  html body .acao-dock .subscribe-anchor-floating:active {
    color: var(--ui-navy, #120363);
    background: var(--ui-yellow, #ffcf00);
    text-decoration: none;
  }

  html body .acao-dock .subscribe-anchor-floating:focus-visible,
  html body .acao-dock .whatsapp-float:focus-visible {
    outline: 3px solid var(--ui-navy, #120363);
    outline-offset: 2px;
  }

  .acao-dock .subscribe-anchor-floating > i {
    flex: none;
  }

  .acao-dock .subscribe-anchor-floating > .fa-arrow-right {
    transition: transform 0.2s ease;
  }

  .acao-dock .subscribe-anchor-floating:hover > .fa-arrow-right,
  .acao-dock .subscribe-anchor-floating:active > .fa-arrow-right {
    transform: translateX(3px);
  }

  /* Brilho: um reflexo diagonal atravessa o botão em 0,9 s, a cada 8 s. Pausado com a dock fora da tela. */
  .acao-dock .subscribe-anchor-floating::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    width: 40%;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.35) 50%,
      rgba(255, 255, 255, 0) 100%
    );
    transform: translateX(-150%) skewX(-20deg);
    animation: acao-dock-brilho 8s linear 1s infinite;
    pointer-events: none;
  }

  .acao-dock.is-oculta .subscribe-anchor-floating::before,
  .acao-dock.is-cta-oculta .subscribe-anchor-floating::before,
  .acao-dock.is-recolhida .subscribe-anchor-floating::before {
    animation-play-state: paused;
  }

  /* ----- WhatsApp ----- */
  html body .acao-dock .whatsapp-float {
    position: static;
    inset: auto;
    z-index: auto;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #25d366;
    color: #fff;
    text-decoration: none;
    animation: none;
    box-shadow: none;
  }

  html body .acao-dock .whatsapp-float > .fa-whatsapp {
    font-size: 28px;
  }
}

/* ---------- Movimento reduzido: sem brilho e sem transições (o estado só troca) ---------- */
@media (prefers-reduced-motion: reduce) {
  .acao-dock,
  .acao-dock.is-pronta,
  .acao-dock.is-pronta .subscribe-anchor-floating,
  .acao-dock .subscribe-anchor-floating > .fa-arrow-right {
    transition: none;
  }

  .acao-dock .subscribe-anchor-floating::before {
    animation: none;
    display: none;
  }
}

/* Selo do reCAPTCHA v3 (canto inferior direito): no celular ficava atrás da dock. O style.css o põe a 40px;
   com a dock na página, sobe acima dela (dock = 68px de altura + 12px de margem + área segura). */
@media (max-width: 767.98px) {
  html body:has(.acao-dock) .grecaptcha-badge {
    bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  }
}
