/* Widget flotante de WhatsApp. Clases con prefijo bw-wa-. */

.bw-wa {
  --bw-wa-green: #25d366;
  --bw-wa-green-dark: #1daf55;
  --bw-wa-header: #0e9a6d;
  --bw-wa-ink: #111b21;
  --bw-wa-right: 18px;
  --bw-wa-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  position: fixed;
  right: calc(var(--bw-wa-right) + env(safe-area-inset-right, 0px));
  bottom: var(--bw-wa-bottom);
  z-index: 100000;
  width: 50px;
  height: 50px;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--bw-wa-ink);
  -webkit-font-smoothing: antialiased;
}

.bw-wa *,
.bw-wa *::before,
.bw-wa *::after {
  box-sizing: border-box;
}

.bw-wa p {
  margin: 0;
}

@media (min-width: 768px) {
  .bw-wa {
    /* Por encima del botón de volver arriba del tema. */
    --bw-wa-bottom: 80px;
  }
}

.bw-wa-launcher,
.bw-wa-close,
.bw-wa-send {
  font-family: inherit;
  cursor: pointer;
}

.bw-wa-launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bw-wa-green);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 80, 50, 0.28);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.bw-wa-launcher:hover {
  background: var(--bw-wa-green-dark);
  transform: scale(1.04);
}

.bw-wa-launcher:focus-visible,
.bw-wa-close:focus-visible,
.bw-wa-send:focus-visible {
  outline: 2px solid #075e54;
  outline-offset: 3px;
}

.bw-wa-icon {
  display: block;
  width: 26px;
  height: 26px;
}

.bw-wa-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #ff3b30;
}

.bw-wa-is-open .bw-wa-badge {
  display: none;
}

.bw-wa-panel[hidden] {
  display: none !important;
}

.bw-wa-panel {
  position: absolute;
  right: 0;
  bottom: 65px;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100vw - 36px));
  max-height: min(520px, calc(100dvh - 150px));
  overflow: hidden;
  border-radius: 18px;
  background: #efeae2;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.bw-wa-panel.bw-wa-panel-in {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.bw-wa-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 12px 14px 14px;
  background: var(--bw-wa-header);
  color: #fff;
}

.bw-wa-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.bw-wa-avatar-photo {
  background: #fff;
}

.bw-wa-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.bw-wa-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--bw-wa-header);
  border-radius: 50%;
  background: var(--bw-wa-green);
}

.bw-wa-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.bw-wa-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.bw-wa-subtitle {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bw-wa-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-top: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  align-self: flex-start;
}

.bw-wa-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.bw-wa-close svg {
  display: block;
  width: 18px;
  height: 18px;
}

.bw-wa-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 210px;
  padding: 16px 16px 18px;
  overflow-y: auto;
  background-color: #efeae2;
  background-image: url("pattern.svg");
  background-repeat: repeat;
  background-size: cover;
}

.bw-wa-thread {
  max-width: 92%;
}

.bw-wa-time {
  margin: 0 4px 4px 0;
  color: #8d8d8d;
  font-size: 12px;
  line-height: 1;
  text-align: right;
}

.bw-wa-bubble {
  position: relative;
  padding: 10px 12px;
  border-radius: 0 14px 14px 14px;
  background: #fff;
  color: var(--bw-wa-ink);
  font-size: 15px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.bw-wa-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -7px;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}

.bw-wa-send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--bw-wa-green);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(18, 140, 70, 0.25);
}

.bw-wa-send:hover,
.bw-wa-send:focus {
  background: var(--bw-wa-green-dark);
  color: #fff;
  text-decoration: none;
}

.bw-wa-send .bw-wa-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

@media (max-width: 480px) {
  .bw-wa {
    --bw-wa-right: 14px;
    --bw-wa-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .bw-wa-panel {
    width: min(340px, calc(100vw - 28px));
    max-height: min(480px, calc(100dvh - 110px));
  }

  .bw-wa-title {
    font-size: 16px;
  }

  .bw-wa-send {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bw-wa-launcher,
  .bw-wa-panel {
    transition: none;
  }

  .bw-wa-launcher:hover {
    transform: none;
  }
}
