/* ==========================================================================
   Widget Flutuante Elegante de Chat — WhatsApp
   ========================================================================== */

body.is-loading .wa-widget {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.wa-widget {
  position: fixed;
  right: clamp(1rem, 2.6vw, 2rem);
  bottom: clamp(1rem, 2.6vw, 2rem);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.6s var(--ease-elegant) 0.45s,
    transform 0.6s var(--ease-elegant) 0.45s;
}

body.is-ready .wa-widget {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Janela do Chat Flutuante
   ========================================================================== */

.wa-chat {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.9rem);
  width: min(360px, calc(100vw - 2rem));
  background: var(--off-white);
  border-radius: 18px;
  border: 1px solid rgba(8, 47, 73, 0.11);
  box-shadow:
    0 24px 54px rgba(8, 47, 73, 0.18),
    0 4px 14px rgba(8, 47, 73, 0.08);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 0.32s var(--ease-elegant),
    transform 0.36s var(--ease-elegant),
    visibility 0.32s ease;
}

.wa-widget.is-open .wa-chat {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.wa-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.05rem 1.15rem;
  background:
    linear-gradient(135deg, var(--azul-profundo) 0%, #0D3F61 100%);
  color: var(--off-white);
}

.wa-chat__profile {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.wa-chat__avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(232, 240, 244, 0.12);
  border: 1px solid rgba(125, 169, 190, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--off-white);
}

.wa-chat__avatar svg {
  width: 26px;
  height: auto;
}

.wa-chat__status-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--azul-profundo);
}

.wa-chat__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wa-chat__name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--branco);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat__subtitle {
  font-size: 0.76rem;
  color: var(--azul-sereno);
  margin-top: 2px;
}

.wa-chat__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(232, 240, 244, 0.75);
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.wa-chat__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--branco);
}

.wa-chat__close svg {
  width: 16px;
  height: 16px;
}

/* Corpo do chat */
.wa-chat__body {
  padding: 1.15rem 1.15rem 1rem;
  background:
    radial-gradient(circle at top right, rgba(232, 240, 244, 0.75), transparent 65%),
    var(--off-white);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.wa-chat__bubble {
  background: var(--branco);
  border: 1px solid rgba(8, 47, 73, 0.08);
  border-radius: 4px 14px 14px 14px;
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 14px rgba(8, 47, 73, 0.04);
}

.wa-chat__bubble p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--grafite-azulado);
}

.wa-chat__bubble p + p {
  margin-top: 0.45rem;
}

.wa-chat__time {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.7rem;
  color: var(--grafite-suave);
  text-align: right;
}

/* Opções rápidas elegantes */
.wa-chat__quick-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--azul-oceano);
}

.wa-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.wa-chat__chip {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--azul-profundo);
  background: var(--azul-nevoa);
  border: 1px solid rgba(36, 94, 122, 0.16);
  padding: 0.45rem 0.78rem;
  border-radius: var(--radius-pill);
  transition:
    background-color 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s var(--ease-elegant);
}

.wa-chat__chip:hover,
.wa-chat__chip.is-selected {
  background: var(--azul-profundo);
  color: var(--off-white);
  border-color: var(--azul-profundo);
  transform: translateY(-1px);
}

/* Rodapé compositor */
.wa-chat__footer {
  padding: 0.85rem 1rem 0.95rem;
  background: var(--branco);
  border-top: 1px solid rgba(8, 47, 73, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.wa-chat__form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wa-chat__input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--grafite-azulado);
  background: var(--off-white);
  border: 1px solid rgba(8, 47, 73, 0.12);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.wa-chat__input::placeholder {
  color: var(--grafite-suave);
}

.wa-chat__input:focus {
  border-color: var(--azul-oceano);
  background: var(--branco);
}

.wa-chat__send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--azul-profundo);
  color: var(--branco);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background-color 0.22s ease,
    transform 0.22s var(--ease-elegant);
}

.wa-chat__send:hover {
  background: var(--azul-oceano);
  transform: translateY(-1px);
}

.wa-chat__send svg {
  width: 17px;
  height: 17px;
}

.wa-chat__number-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--grafite-suave);
}

.wa-chat__number-note a {
  font-weight: 600;
  color: var(--azul-oceano);
}

.wa-chat__number-note a:hover {
  color: var(--azul-profundo);
  text-decoration: underline;
}

/* ==========================================================================
   Botão Flutuante Principal (Launcher)
   ========================================================================== */

.wa-launcher {
  position: relative;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.82rem 1.25rem 0.82rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--azul-profundo);
  color: var(--off-white);
  box-shadow:
    0 14px 32px rgba(8, 47, 73, 0.26),
    0 2px 8px rgba(8, 47, 73, 0.14);
  border: 1px solid rgba(125, 169, 190, 0.24);
  transition:
    background-color 0.28s ease,
    transform 0.3s var(--ease-elegant),
    box-shadow 0.3s ease;
}

.wa-launcher:hover {
  background: var(--azul-oceano);
  transform: translateY(-2px);
  box-shadow:
    0 18px 38px rgba(8, 47, 73, 0.3),
    0 4px 10px rgba(36, 94, 122, 0.18);
}

/* Halo discreto pulsante */
.wa-launcher::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid rgba(125, 169, 190, 0.45);
  opacity: 0;
  pointer-events: none;
  animation: waLauncherPulse 3.6s ease-out infinite;
}

.wa-widget.is-open .wa-launcher::before {
  animation: none;
  opacity: 0;
}

.wa-launcher__icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.wa-launcher__icon-wrap svg {
  width: 22px;
  height: 22px;
}

.wa-launcher__dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--azul-profundo);
  transition: border-color 0.28s ease;
}

.wa-launcher:hover .wa-launcher__dot {
  border-color: var(--azul-oceano);
}

.wa-launcher__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.wa-launcher__title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--branco);
}

.wa-launcher__sub {
  font-size: 0.72rem;
  color: var(--azul-nevoa);
  opacity: 0.85;
  margin-top: 2px;
}

@keyframes waLauncherPulse {
  0% {
    opacity: 0.55;
    transform: scale(1);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.08, 1.24);
  }
}

@media (max-width: 560px) {
  .wa-chat__input {
    font-size: 16px;
  }

  .wa-launcher {
    padding: 0.9rem;
  }

  .wa-launcher__text {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-launcher::before {
    animation: none;
  }
}
