/* WhatsApp chat widget — modelo visual padrão */
.wa-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1900;
  font-family: "Sora", system-ui, sans-serif;
  --wa: #25D366;
  --wa-dark: #128C7E;
  --wa-header: #075E54;
}

.wa-widget__fab {
  position: relative;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--wa);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(37, 211, 102, .38);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.wa-widget__fab:hover {
  transform: scale(1.06);
  background: var(--wa-dark);
  box-shadow: 0 14px 32px rgba(18, 140, 126, .4);
}

.wa-widget__fab:active {
  transform: scale(.96);
}

.wa-widget__fab svg {
  width: 30px;
  height: 30px;
  display: block;
}

.wa-widget__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #E53935;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(229, 57, 53, .4);
  border: 2px solid #fff;
}

.wa-widget__panel {
  position: absolute;
  right: 0;
  bottom: calc(60px + 14px);
  width: min(360px, calc(100vw - 28px));
  background: #ECE5DD;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  pointer-events: none;
}

.wa-widget.is-open .wa-widget__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.wa-widget__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 14px;
  background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
  color: #fff;
}

.wa-widget__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
  border: 2px solid rgba(255, 255, 255, .35);
  flex-shrink: 0;
}

.wa-widget__header-info {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.wa-widget__header-info strong {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.wa-widget__online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, .88);
}

.wa-widget__online i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}

.wa-widget__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.wa-widget__close:hover {
  background: rgba(255, 255, 255, .2);
}

.wa-widget__messages {
  padding: 16px 14px 10px;
  display: grid;
  gap: 10px;
  min-height: 150px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .35), transparent 40%),
    #ECE5DD;
}

.wa-widget__bubble {
  width: fit-content;
  max-width: 88%;
  background: #fff;
  color: #1f2a24;
  border-radius: 14px 14px 14px 4px;
  padding: 10px 12px 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}

.wa-widget__bubble p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
}

.wa-widget__bubble time {
  display: block;
  margin-top: 6px;
  text-align: right;
  font-size: 10.5px;
  color: #809089;
}

.wa-widget__footer {
  padding: 12px 14px 14px;
  background: #f7f7f7;
  border-top: 1px solid rgba(0, 0, 0, .06);
}

.wa-widget__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--wa);
  color: #062116;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(37, 211, 102, .28);
  transition: background .2s, transform .15s;
}

.wa-widget__cta:hover {
  background: var(--wa-dark);
  color: #fff;
  transform: translateY(-1px);
}

.wa-widget__cta svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.wa-widget__micro {
  margin: 10px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #6b7a73;
}

/* Mobile: FAB do chat centralizado no menu inferior (micro-SaaS) */
body.android-app .wa-widget {
  left: 50%;
  right: auto;
  bottom: calc(var(--bottom-nav-h, 64px) + env(safe-area-inset-bottom, 0px) - 28px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.android-app .wa-widget__fab {
  width: 58px;
  height: 58px;
  box-shadow:
    0 8px 24px rgba(37, 211, 102, .42),
    0 0 0 5px rgba(247, 251, 254, .95);
}

body.android-app .wa-widget__panel {
  right: auto;
  left: 50%;
  bottom: calc(58px + 16px);
  width: min(340px, calc(100vw - 24px));
  transform: translateX(-50%) translateY(14px) scale(.98);
  transform-origin: bottom center;
}

body.android-app .wa-widget.is-open .wa-widget__panel {
  transform: translateX(-50%) translateY(0) scale(1);
}

body.android-app .fab {
  display: none !important;
}

@media (max-width: 480px) {
  .wa-widget {
    right: 14px;
    bottom: 16px;
  }

  body.android-app .wa-widget {
    left: 50%;
    right: auto;
    bottom: calc(var(--bottom-nav-h, 64px) + env(safe-area-inset-bottom, 0px) - 28px);
    transform: translateX(-50%);
  }

  .wa-widget__panel {
    width: min(340px, calc(100vw - 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-widget__panel,
  .wa-widget__fab {
    transition: none;
  }
}
