/* ── WhatsApp Chat Replayer Component ──────────────────────── */

.wa-replay {
  width: 100%;
  max-width: 380px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-2xl);
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-alt);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

.wa-replay::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(41, 92, 69, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

/* ── Header ────────────────────────────────────────────────── */

.wa-replay__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: #075e54;
  color: #fff;
  position: relative;
  z-index: 1;
}

.wa-replay__avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--brand-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}

.wa-replay__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-replay__contact-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.wa-replay__name {
  font-weight: 600;
  font-size: 15px;
}

.wa-replay__status {
  font-size: 12px;
  opacity: 0.85;
}

/* ── Body ──────────────────────────────────────────────────── */.wa-replay__menu {
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  pointer-events: none;
}

/* ── Body ──────────────────────────────────────────────────── */

.wa-replay__body {
  height: 400px;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  scroll-behavior: smooth;
  background-color: #efeae2;
  background-image: url("../../img/whatsapp-chat-bg-light.png");
  background-repeat: repeat;
  position: relative;
  z-index: 1;
}

.wa-replay__body::-webkit-scrollbar {
  display: none;
}


/* ── Messages ──────────────────────────────────────────────── */

.wa-replay__msg {
  max-width: 82%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  line-height: 1.5;
  animation: waReplayPop 0.15s ease-out;
  word-break: break-word;
  font-size: 13.5px;
}

.wa-replay__msg--them {
  background: #fff;
  color: #1c1c1a;
  align-self: flex-start;
  border-top-left-radius: 0;
}

.wa-replay__msg--me {
  background: #dcf8c6;
  color: #1c1c1a;
  align-self: flex-end;
  border-top-right-radius: 0;
}

/* ── Typing indicator ──────────────────────────────────────── */

.wa-replay__typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  background: #fff !important;
  max-width: 60px;
  border-top-left-radius: 0;
  animation: none;
}

.wa-replay__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #909090;
  animation: waReplayDot 1.4s infinite;
}

.wa-replay__typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.wa-replay__typing span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ── Animations ────────────────────────────────────────────── */

@keyframes waReplayPop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes waReplayDot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.3;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ── Pause/Play Overlay ─────────────────────────────────────── */

.wa-replay__overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: pointer;
  pointer-events: none;
}

.wa-replay__overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.wa-replay__overlay-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.wa-replay__overlay-icon:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.08);
}

.wa-replay__overlay-icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.wa-replay:hover .wa-replay__overlay--running,
.wa-replay:hover .wa-replay__overlay--finished {
  opacity: 1;
  pointer-events: auto;
}

.wa-replay__overlay--paused {
  opacity: 1;
  pointer-events: auto;
}

.wa-replay__overlay--finished {
  opacity: 0;
  pointer-events: none;
}

/* ── Hero variant ─────────────────────────────────────────── */

.wa-replay--hero {
  max-width: 400px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.45),
    0 0 80px rgba(41, 92, 69, 0.15);
  animation: heroFloat 6s ease-in-out infinite;
  border-color: transparent;
}

.wa-replay--hero::before {
  background: none;
}

.wa-replay--hero .wa-replay__body {
  height: 420px;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Reduced motion ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .wa-replay__msg {
    animation: none;
  }
  .wa-replay__typing span {
    animation: none;
    opacity: 0.6;
  }
  .wa-replay--hero {
    animation: none;
  }
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .wa-replay--hero {
    max-width: 360px;
    animation: none;
  }
  .wa-replay--hero .wa-replay__body {
    height: 360px;
  }
}

@media (max-width: 480px) {
  .wa-replay {
    max-width: 100%;
  }
  .wa-replay__body {
    height: 320px;
  }
  .wa-replay--hero {
    max-width: 100%;
  }
  .wa-replay--hero .wa-replay__body {
    height: 340px;
  }
}
