/* ══════════════════════════════════════════════════════
   Anerva — WhatsApp Floating Widget  v1.0
   ══════════════════════════════════════════════════════ */

#tp-wa-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

/* ── Floating Bubble ── */
#tp-wa-bubble {
  width: 60px;
  height: 60px;
  background: #25D366;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.5);
  transition: transform .25s ease, box-shadow .25s ease;
  position: relative;
  animation: tp-wa-bounce 2.5s ease-in-out infinite;
}
#tp-wa-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(37,211,102,.6);
  animation: none;
}
#tp-wa-bubble svg {
  width: 32px;
  height: 32px;
  color: #fff;
  fill: #fff;
}
@keyframes tp-wa-bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* Notification dot */
.tp-wa-notif {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: .68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: tp-wa-pulse 1.6s ease-in-out infinite;
}
@keyframes tp-wa-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}

/* ── Chat Window ── */
#tp-wa-box {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  animation: tp-wa-pop .3s cubic-bezier(.34,1.56,.64,1);
}
#tp-wa-box[hidden] { display: none !important; }
@keyframes tp-wa-pop {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* Header */
.tp-wa-header {
  background: #075E54;
  padding: .875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.tp-wa-header__left {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.tp-wa-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.tp-wa-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.tp-wa-avatar--default {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #128C7E;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
}
.tp-wa-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #075E54;
}
.tp-wa-status-dot.online  { background: #4ade80; }
.tp-wa-status-dot.offline { background: #9ca3af; }
.tp-wa-agent-name   { font-size: .9rem; font-weight: 700; color: #fff; }
.tp-wa-agent-status { font-size: .72rem; color: rgba(255,255,255,.75); margin-top: .1rem; }
.tp-wa-header__right { display: flex; gap: .375rem; }
.tp-wa-header__right button {
  width: 28px; height: 28px;
  background: rgba(255,255,255,.15);
  border: none; border-radius: 50%;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.tp-wa-header__right button:hover { background: rgba(255,255,255,.3); }

/* Body / wallpaper */
.tp-wa-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
  min-height: 240px;
  max-height: 340px;
}
.tp-wa-wallpaper {
  position: absolute;
  inset: 0;
  background-color: #ece5dd;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c8b8a2' fill-opacity='0.25'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.tp-wa-messages {
  position: relative;
  z-index: 1;
  padding: .875rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* Message bubbles */
.tp-wa-msg {
  max-width: 82%;
  padding: .5rem .875rem;
  border-radius: 8px;
  font-size: .875rem;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
  animation: tp-wa-fade-in .25s ease;
}
@keyframes tp-wa-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tp-wa-msg--bot {
  background: #fff;
  color: #1a1a1a;
  border-radius: 0 8px 8px 8px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.tp-wa-msg--user {
  background: #dcf8c6;
  color: #1a1a1a;
  border-radius: 8px 0 8px 8px;
  align-self: flex-end;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.tp-wa-msg__time {
  font-size: .62rem;
  color: #999;
  text-align: right;
  margin-top: .25rem;
}
.tp-wa-msg--user .tp-wa-msg__time { color: #6b9c6b; }

/* Typing indicator */
.tp-wa-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .5rem .875rem;
  background: #fff;
  border-radius: 0 8px 8px 8px;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.tp-wa-typing span {
  width: 7px; height: 7px;
  background: #999;
  border-radius: 50%;
  animation: tp-wa-dot 1.2s ease-in-out infinite;
}
.tp-wa-typing span:nth-child(2) { animation-delay: .2s; }
.tp-wa-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes tp-wa-dot {
  0%,80%,100% { transform: scale(.8); opacity: .5; }
  40%          { transform: scale(1.2); opacity: 1; }
}

/* Footer / input */
.tp-wa-footer {
  background: #f0f0f0;
  padding: .625rem .75rem .5rem;
  flex-shrink: 0;
  border-top: 1px solid #e0e0e0;
}
.tp-wa-input-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #fff;
  border-radius: 24px;
  padding: .25rem .25rem .25rem .875rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
#tp-wa-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: .9rem;
  font-family: inherit;
  background: transparent;
  color: #1a1a1a;
  padding: .375rem 0;
}
#tp-wa-input::placeholder { color: #aaa; }
#tp-wa-input:disabled { opacity: .5; }
#tp-wa-send {
  width: 38px; height: 38px;
  background: #25D366;
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .2s, transform .15s;
}
#tp-wa-send:hover  { background: #1ebe5d; transform: scale(1.08); }
#tp-wa-send:active { transform: scale(.95); }
#tp-wa-send svg { fill: #fff; }
#tp-wa-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.tp-wa-powered {
  text-align: center;
  font-size: .65rem;
  color: #aaa;
  margin-top: .375rem;
}

/* Mobile */
@media (max-width: 480px) {
  #tp-wa-box {
    width: calc(100vw - 32px);
    right: -12px;
    bottom: 72px;
  }
  #tp-wa-widget {
    bottom: 16px;
    right: 16px;
  }
}
