/* WA-MOBILE-FIX-20260727 */
/* ── WhatsApp widget — realistic launcher + chat panel ── */
.wa-widget {
  --wa-green: #25d366;
  --wa-green-dark: #128c7e;
  --wa-header: #008069;
  --wa-header-dark: #006652;
  --wa-bg: #efeae2;
  --wa-bubble: #ffffff;
  --wa-text: #111b21;
  --wa-muted: #667781;
  --wa-tick: #53bdeb;

  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, "Inter", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Teaser mini-bubble ── */
.wa-widget__teaser {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(280px, calc(100vw - 44px));
  padding: 12px 14px 12px 12px;
  border-radius: 14px;
  background: var(--wa-bubble);
  box-shadow:
    0 8px 28px rgba(11, 20, 26, 0.16),
    0 2px 6px rgba(11, 20, 26, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.94);
  transform-origin: right bottom;
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.5s cubic-bezier(0.34, 1.35, 0.64, 1),
    visibility 0.45s;
  cursor: pointer;
}

.wa-widget__teaser::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  background: var(--wa-bubble);
  transform: rotate(45deg);
  box-shadow: 3px 3px 5px rgba(11, 20, 26, 0.06);
}

.wa-widget.is-teaser-visible .wa-widget__teaser {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.wa-widget.is-open .wa-widget__teaser,
.wa-widget.is-teaser-hidden .wa-widget__teaser {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.wa-widget__teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  color: var(--wa-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.wa-widget__teaser-close:hover {
  opacity: 1;
}

.wa-widget__teaser-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-widget__teaser-ava {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e9edef;
}

.wa-widget__teaser-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-widget__teaser-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 16px;
}

.wa-widget__teaser-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--wa-text);
}

.wa-widget__teaser-text span {
  font-size: 13px;
  line-height: 1.35;
  color: var(--wa-muted);
}

/* ── Chat panel ── */
.wa-widget__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  display: flex;
  flex-direction: column;
  width: min(372px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  border-radius: 14px;
  overflow: hidden;
  background: var(--wa-bg);
  box-shadow:
    0 20px 60px rgba(11, 20, 26, 0.28),
    0 0 0 1px rgba(11, 20, 26, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(0.9);
  transform-origin: right bottom;
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.48s cubic-bezier(0.34, 1.45, 0.64, 1),
    visibility 0.4s;
}

.wa-widget.is-open .wa-widget__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header bar */
.wa-widget__bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 8px 4px;
  background: var(--wa-header);
  color: #fff;
}

.wa-widget__bar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  opacity: 0.92;
  transition: background 0.2s;
}

.wa-widget__bar-back:hover {
  background: rgba(255, 255, 255, 0.12);
}

.wa-widget__bar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.wa-widget__bar-ava {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #dfe5e7;
}

.wa-widget__bar-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-widget__bar-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wa-widget__bar-info strong {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-widget__bar-status {
  font-size: 13px;
  opacity: 0.85;
}

.wa-widget__bar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 6px;
  opacity: 0.88;
}

.wa-widget__bar-actions span {
  display: flex;
}

/* Chat body */
.wa-widget__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 8px;
  background-color: var(--wa-bg);
  background-image: url("data:image/svg+xml,%3Csvg width='412' height='412' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c8b8a8' fill-opacity='0.09'%3E%3Cpath d='M0 0h206v206H0zm206 206h206v206H206z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 412px;
}

.wa-widget__date {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.wa-widget__date span {
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(225, 218, 208, 0.95);
  font-size: 12px;
  color: var(--wa-muted);
  box-shadow: 0 1px 1px rgba(11, 20, 26, 0.06);
}

.wa-widget__typing {
  margin-bottom: 4px;
  transition: opacity 0.3s ease;
}

.wa-widget.is-chat-ready .wa-widget__typing {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.wa-widget__messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Incoming bubble */
.wa-widget__bubble {
  position: relative;
  max-width: 88%;
  align-self: flex-start;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
}

.wa-widget__bubble--in {
  padding: 6px 8px 4px 10px;
  border-radius: 0 8px 8px 8px;
  background: var(--wa-bubble);
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}

.wa-widget__bubble--in::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent var(--wa-bubble) transparent transparent;
}

.wa-widget__bubble p {
  margin: 0 0 2px;
  font-size: 14.2px;
  line-height: 1.42;
  color: var(--wa-text);
}

.wa-widget__meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 2px;
}

.wa-widget__time {
  font-size: 11px;
  color: var(--wa-muted);
}

.wa-widget__ticks {
  width: 16px;
  height: 11px;
  flex-shrink: 0;
}

.wa-widget.is-chat-ready .wa-widget__bubble--m1 {
  animation: wa-bubble-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.wa-widget.is-chat-ready .wa-widget__bubble--m2 {
  animation: wa-bubble-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
}

@keyframes wa-bubble-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Typing dots bubble */
.wa-widget__bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  opacity: 1;
  transform: none;
}

.wa-widget__bubble--typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #90a4ae;
  animation: wa-dot-typing 1.3s ease infinite;
}

.wa-widget__bubble--typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.wa-widget__bubble--typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes wa-dot-typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* Footer / input */
.wa-widget__foot {
  flex-shrink: 0;
  padding: 8px 10px 10px;
  background: #f0f2f5;
  border-top: 1px solid #e9edef;
}

.wa-widget__input-fake {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  margin-bottom: 8px;
  border-radius: 24px;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.06);
  transition: box-shadow 0.2s;
}

.wa-widget__input-fake:hover {
  box-shadow: 0 2px 8px rgba(11, 20, 26, 0.1);
}

.wa-widget__input-placeholder {
  flex: 1;
  font-size: 14px;
  color: #8696a0;
}

.wa-widget__input-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wa-green);
  color: #fff;
}

.wa-widget__input-send svg {
  width: 18px;
  height: 18px;
}

.wa-widget__go {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  background: var(--wa-green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}

.wa-widget__go svg {
  width: 20px;
  height: 20px;
}

.wa-widget__go:hover {
  background: #20bd5a;
  color: #fff;
  transform: translateY(-1px);
}

.wa-widget__encrypted {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 8px 0 0;
  font-size: 10.5px;
  color: var(--wa-muted);
}

/* ── Launcher pill button ── */
.wa-widget__launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 64px;
  padding: 0;
  border: none;
  border-radius: 32px;
  background: transparent;
  cursor: pointer;
  outline: none;
}

.wa-widget__launcher-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0;
  height: 60px;
  padding: 0 18px 0 16px;
  border-radius: 30px;
  background: linear-gradient(180deg, #2fe06a 0%, var(--wa-green) 45%, #1da851 100%);
  color: #fff;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition:
    width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.wa-widget__launcher:hover .wa-widget__launcher-inner {
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.wa-widget.is-open .wa-widget__launcher-inner {
  width: 60px;
  padding: 0;
  justify-content: center;
  background: linear-gradient(180deg, #455a64 0%, #37474f 100%);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.wa-widget__launcher-icon {
  display: flex;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  transition: opacity 0.25s, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.wa-widget__launcher-icon svg {
  width: 100%;
  height: 100%;
}

.wa-widget__launcher-icon--wa {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.wa-widget__launcher-icon--x {
  position: absolute;
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.wa-widget.is-open .wa-widget__launcher-icon--wa {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

.wa-widget.is-open .wa-widget__launcher-icon--x {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.wa-widget__launcher-label {
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding-left: 10px;
  transition:
    max-width 0.35s ease,
    opacity 0.25s ease,
    padding 0.35s ease;
}

.wa-widget.is-open .wa-widget__launcher-label {
  max-width: 0;
  opacity: 0;
  padding-left: 0;
}

.wa-widget__launcher-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 3;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #ff3b30;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.45);
  animation: wa-badge-in 0.5s cubic-bezier(0.34, 1.5, 0.64, 1) 3s both;
  transition: opacity 0.25s, transform 0.25s;
}

.wa-widget.is-open .wa-widget__launcher-badge,
.wa-widget.is-teaser-visible .wa-widget__launcher-badge {
  opacity: 0;
  transform: scale(0);
}

@keyframes wa-badge-in {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@media (max-width: 580px) {
  .wa-widget {
    right: 14px;
    bottom: 14px;
  }

  .wa-widget__launcher-inner {
    height: 56px;
    padding: 0 14px 0 14px;
  }

  .wa-widget.is-open .wa-widget__launcher-inner {
    width: 56px;
  }

  .wa-widget__launcher-label {
    display: none;
  }

  /*
   * Panel: parent .wa-widget is only ~58px wide (launcher button),
   * so calc(100%) = ~58px. Use 100vw to reference the actual viewport.
   * Widget sits at right:14px, so panel right:0 aligns to that edge.
   * Width = 100vw - 28px spans from 14px left to 14px right.
   */
  .wa-widget__panel {
    width: calc(100vw - 28px);
    max-width: 360px;
    height: min(480px, calc(100dvh - 100px));
    right: 0;
  }

  .wa-widget__teaser {
    width: min(280px, calc(100vw - 28px));
    max-width: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-widget__launcher-badge {
    animation: none;
  }

  .wa-widget__bubble,
  .wa-widget__panel,
  .wa-widget__teaser {
    transition-duration: 0.15s;
  }
}
