/**
 * Divino Felix & Advogados Associados - Estilos Globais & Sistema de Animações
 * Animações Bidirecionais em Slow Motion (2.5s), Cascata & Zoom Out
 */

:root {
  --ease-slowmo: cubic-bezier(0.16, 1, 0.3, 1);
  --anim-duration: 2.5s;
}

/* ==========================================================================
   1. SISTEMA DE ANIMAÇÕES BIDIRECIONAIS: SLOW MOTION (2.5s) & CASCATA
   ========================================================================== */

/* 1.1 Elementos com Efeito Cascata Caindo Suavemente */
.anim-cascade {
  opacity: 0;
  transform: translateY(-26px);
  will-change: opacity, transform;
  transition: opacity var(--anim-duration) var(--ease-slowmo),
              transform var(--anim-duration) var(--ease-slowmo);
  transition-delay: var(--cascade-delay, 0s);
}

/* Estado Ativo / Revelado */
.anim-cascade.is-revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Saída Bidirecional Fluida (ao sair da viewport, reseta suavemente e rápido para reentrada) */
.anim-cascade:not(.is-revealed) {
  opacity: 0;
  transform: translateY(-26px);
  transition: opacity 0.8s var(--ease-slowmo),
              transform 0.8s var(--ease-slowmo);
  transition-delay: 0s !important;
}

/* 1.2 Imagens e Elementos Visuais com Zoom Out Bidirecional em Slow Motion (2.5s) */
.anim-zoom-out {
  opacity: 0;
  transform: scale(1.15);
  will-change: opacity, transform;
  transition: opacity var(--anim-duration) var(--ease-slowmo),
              transform var(--anim-duration) var(--ease-slowmo);
  transition-delay: var(--cascade-delay, 0s);
}

.anim-zoom-out.is-revealed {
  opacity: 1;
  transform: scale(1);
}

.anim-zoom-out:not(.is-revealed) {
  opacity: 0;
  transform: scale(1.15);
  transition: opacity 0.8s var(--ease-slowmo),
              transform 0.8s var(--ease-slowmo);
  transition-delay: 0s !important;
}

/* Fundo da Hero Específico com Zoom Out Atmosférico */
.hero-bg-zoom.anim-zoom-out {
  opacity: 0;
  transform: scale(1.20);
}

.hero-bg-zoom.anim-zoom-out.is-revealed {
  opacity: 0.40;
  transform: scale(1.05);
}

.hero-bg-zoom.anim-zoom-out:not(.is-revealed) {
  opacity: 0;
  transform: scale(1.20);
  transition: opacity 0.8s var(--ease-slowmo),
              transform 0.8s var(--ease-slowmo);
  transition-delay: 0s !important;
}

/* 1.3 Acessibilidade para Usuários com Redução de Movimento */
@media (prefers-reduced-motion: reduce) {
  .anim-cascade,
  .anim-zoom-out,
  .hero-bg-zoom.anim-zoom-out {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   2. ACCORDION PREMIUM DE FAQ (Expansão Ultra Fluida & Microinterações)
   ========================================================================== */
.faq-item {
  transition: border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item:hover {
  border-color: rgba(197, 160, 89, 0.45);
  box-shadow: 0 10px 25px -5px rgba(2, 23, 50, 0.05);
}

.faq-item.is-open {
  border-color: rgba(197, 160, 89, 0.65) !important;
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 80%, rgba(197, 160, 89, 0.04) 100%) !important;
  box-shadow: 0 16px 36px -8px rgba(2, 23, 50, 0.08), 0 0 0 1px rgba(197, 160, 89, 0.35) !important;
}

.faq-num-badge {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-open .faq-num-badge {
  background-color: #021732 !important;
  color: #C5A059 !important;
  border-color: rgba(197, 160, 89, 0.6) !important;
  box-shadow: 0 4px 12px rgba(2, 23, 50, 0.15) !important;
}

.faq-icon-wrapper {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-open .faq-icon-wrapper {
  background-color: #021732 !important;
  color: #C5A059 !important;
  border-color: rgba(197, 160, 89, 0.6) !important;
  box-shadow: 0 4px 12px rgba(2, 23, 50, 0.15) !important;
}

.faq-icon {
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-answer-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.is-open .faq-answer-wrapper {
  grid-template-rows: 1fr;
}

.faq-item.is-open .faq-answer-inner {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   3. WIDGET DE WHATSAPP INTELIGENTE (botaozap.md)
   ========================================================================== */
.whatsapp-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.whatsapp-widget.widget-visible {
  opacity: 1;
  pointer-events: none;
}

/* Botão Circular Principal - Verde Oficial */
.whatsapp-trigger-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #25D366;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  pointer-events: auto;
}

.whatsapp-svg-icon {
  fill: #FFFFFF;
  width: 28px;
  height: 28px;
}

@media (hover: hover) and (pointer: fine) {
  .whatsapp-trigger-btn:hover {
    transform: scale(1.05);
    background-color: #128C7E;
  }
}

/* Tooltip de Inatividade */
.whatsapp-tooltip {
  background-color: var(--brand-navy, #021732);
  border: 1px solid rgba(197, 160, 89, 0.3);
  color: #FFFFFF;
  padding: 0 18px 0 14px;
  border-radius: 6px;
  margin-bottom: 0;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              margin-bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s;
  will-change: opacity, transform, max-height;
}

.whatsapp-tooltip.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  max-height: 80px;
  padding: 12px 18px 12px 14px;
  margin-bottom: 12px;
  transform: translateY(0) scale(1);
}

.whatsapp-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 25px;
  width: 10px;
  height: 10px;
  background-color: var(--brand-navy, #021732);
  border-right: 1px solid rgba(197, 160, 89, 0.3);
  border-bottom: 1px solid rgba(197, 160, 89, 0.3);
  transform: rotate(45deg);
}

.close-tooltip-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 12px;
  margin: -12px -12px -12px 0;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}
.close-tooltip-btn:hover {
  color: var(--brand-gold, #C5A059);
}

/* Painel de Chat Simulado */
.whatsapp-chat-panel {
  width: 320px;
  background-color: var(--brand-white, #ffffff);
  border: 1px solid rgba(2, 23, 50, 0.1);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
  margin-bottom: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              margin-bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s;
  will-change: transform, opacity, max-height;
}

.whatsapp-chat-panel.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  max-height: 500px;
  margin-bottom: 16px;
  transform: translateY(0) scale(1);
}

.chat-header {
  background-color: var(--brand-navy, #021732);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--brand-gold, #C5A059);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
}

.chat-header-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #FFFFFF;
}

.chat-header-status {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.chat-messages-container {
  padding: 16px;
  max-height: 340px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: #F4F6F9;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 85%;
  word-wrap: break-word;
  flex-shrink: 0;
}

.chat-bubble.received {
  background-color: var(--brand-white, #ffffff);
  color: var(--brand-text-dark, #1e293b);
  align-self: flex-start;
  border-top-left-radius: 2px;
  border: 1px solid rgba(2, 23, 50, 0.05);
}

.chat-bubble.sent {
  background-color: rgba(197, 160, 89, 0.15);
  color: var(--brand-navy, #021732);
  align-self: flex-end;
  border-top-right-radius: 2px;
}

.chat-faq-options {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 8px;
  margin-top: 8px;
  opacity: 1;
  max-height: 300px;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), margin-top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.chat-faq-options.hidden {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  pointer-events: none;
}

/* Cabeçalho mostrado só quando as opções são REEXIBIDAS após uma resposta */
.chat-faq-heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--brand-text-dark, #1e293b);
  opacity: 0.6;
  margin-bottom: 2px;
}

.chat-faq-opt {
  background-color: var(--brand-white, #ffffff);
  border: 1px solid rgba(197, 160, 89, 0.3);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  color: var(--brand-navy, #021732);
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 48px;
  display: flex;
  align-items: center;
}

@media (hover: hover) and (pointer: fine) {
  .chat-faq-opt:hover {
    background-color: rgba(197, 160, 89, 0.08);
    border-color: var(--brand-gold, #C5A059);
  }
}

.chat-footer {
  padding: 12px;
  background-color: var(--brand-white, #ffffff);
  border-top: 1px solid rgba(2, 23, 50, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
}

.chat-direct-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-gold, #C5A059);
  text-decoration: none;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (hover: hover) and (pointer: fine) {
  .chat-direct-link:hover {
    color: var(--brand-navy, #021732);
  }
}

/* Efeito de Digitando (Loader) */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--brand-navy, #021732);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
  opacity: 0.4;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* Acessibilidade - Teclado */
.whatsapp-trigger-btn:focus-visible,
.close-tooltip-btn:focus-visible,
.chat-faq-opt:focus-visible {
  outline: 2px solid var(--brand-gold, #C5A059) !important;
  outline-offset: 2px;
}

/* Responsividade Mobile */
@media (max-width: 767px) {
  .whatsapp-widget {
    bottom: 20px;
    right: 20px;
  }

  /* Desativa tooltip e painel de chat no mobile (redirecionamento direto) */
  .whatsapp-tooltip,
  #whatsapp-tooltip,
  .whatsapp-chat-panel,
  #whatsapp-chat-panel {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Oculta o widget do WhatsApp e eleva o header quando o menu mobile estiver aberto */
body.mobile-nav-open #whatsapp-widget,
body.mobile-nav-open .whatsapp-widget {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(20px) scale(0.85) !important;
  transition: opacity 0.25s ease, transform 0.25s ease !important;
}

body.mobile-nav-open #site-header {
  z-index: 99999 !important;
}

/* ==========================================================================
   MENU MOBILE FULLSCREEN (Transição Fluida & Suave)
   ========================================================================== */
#mobile-nav-panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-16px) scale(0.98);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.4s;
  will-change: opacity, transform;
}

#mobile-nav-panel.is-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

#mobile-nav-panel nav a {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.2s ease,
              border-color 0.2s ease;
}

#mobile-nav-panel.is-open nav a {
  opacity: 1;
  transform: translateY(0);
}

#mobile-nav-panel.is-open nav a:nth-child(1) { transition-delay: 0.06s; }
#mobile-nav-panel.is-open nav a:nth-child(2) { transition-delay: 0.11s; }
#mobile-nav-panel.is-open nav a:nth-child(3) { transition-delay: 0.16s; }
#mobile-nav-panel.is-open nav a:nth-child(4) { transition-delay: 0.21s; }
#mobile-nav-panel.is-open nav a:nth-child(5) { transition-delay: 0.26s; }
#mobile-nav-panel.is-open nav a:nth-child(6) { transition-delay: 0.31s; }
#mobile-nav-panel.is-open nav a:nth-child(7) { transition-delay: 0.36s; }


/* ==========================================================================
   4. SISTEMA DE CONSENTIMENTO DE COOKIES (LGPD - LEI Nº 13.709/2018)
   ========================================================================== */
#lgpd-cookie-banner {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.45s;
}

#lgpd-cookie-banner.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

#lgpd-cookie-panel {
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s,
              margin-bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#lgpd-cookie-panel.is-open {
  max-height: 480px !important;
  opacity: 1 !important;
  visibility: visible !important;
  margin-bottom: 1rem !important;
}

/* Custom LGPD Toggle Switch */
.lgpd-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.lgpd-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.lgpd-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
}

.lgpd-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lgpd-switch input:checked + .lgpd-slider {
  background-color: #C5A059;
  border-color: #C5A059;
}

.lgpd-switch input:checked + .lgpd-slider:before {
  transform: translateX(20px);
  background-color: #021732;
}

.lgpd-switch input:disabled + .lgpd-slider {
  cursor: not-allowed;
  opacity: 0.8;
  background-color: rgba(197, 160, 89, 0.4);
  border-color: rgba(197, 160, 89, 0.5);
}

.lgpd-switch input:disabled + .lgpd-slider:before {
  transform: translateX(20px);
  background-color: #021732;
}

/* Botão Flutuante Discreto de Reabertura de Preferências LGPD */
#lgpd-reopen-btn {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.92);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s;
}

#lgpd-reopen-btn.is-active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

/* ==========================================================================
   5. SIDEBAR FLUTUANTE (STICKY) DO ARTIGO / BLOG
   ========================================================================== */
@media (min-width: 1024px) {
  .artigo-sticky-sidebar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 6.5rem !important; /* 104px (respiro ideal abaixo do header fixo) */
    align-self: flex-start !important;
    z-index: 20;
    will-change: auto !important;
  }
}

