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

.wa-replay {
  width: 100%;
  max-width: 380px;
  height: 506px;
  border-radius: 16px;
  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;
  display: flex;
  flex-direction: column;
  text-align: left;
  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;
  flex-shrink: 0;
}

.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 {
  flex: 1;
  min-height: 0;
  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;
}

/* ── Input Bar ─────────────────────────────────────────────── */

.wa-replay__input-bar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 5px 6px;
  background: #f0f0f0;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.wa-replay__input-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  color: #54656f;
}

.wa-replay__input-field {
  flex: 1;
  min-height: 38px;
  max-height: 144px;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  padding: 8px 32px 8px 14px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.45;
  color: #1c1c1a;
  word-break: break-word;
}

.wa-replay__input-field::-webkit-scrollbar {
  display: none;
}

.wa-replay__input-text {
  white-space: pre-wrap;
}

.wa-replay__input-attach {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #54656f;
}

.wa-replay__input-cursor {
  display: inline-block;
  width: 1.5px;
  height: 15px;
  background: #075e54;
  margin-left: 1px;
  border-radius: 1px;
  opacity: 0;
  vertical-align: text-bottom;
}

.wa-replay__input-bar--streaming .wa-replay__input-cursor {
  animation: cursorBlink 0.5s step-end infinite;
}

.wa-replay__input-bar--done .wa-replay__input-cursor {
  opacity: 0;
  animation: none;
}

.wa-replay__input-bar--idle .wa-replay__input-cursor {
  opacity: 0;
  animation: cursorBlink 1s step-end infinite;
}

.wa-replay__input-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  color: #54656f;
  transition: background 0.15s ease, transform 0.15s ease;
}

.wa-replay__input-bar--done .wa-replay__input-send {
  background: #075e54;
  color: #fff;
  transform: scale(1);
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes sendPop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.wa-replay__input-bar--done .wa-replay__input-send {
  animation: sendPop 0.25s ease-out forwards;
}

.wa-replay__input-bar--streaming .wa-replay__input-attach,
.wa-replay__input-bar--done .wa-replay__input-attach {
  display: none;
}

.wa-replay__input-send--pressed {
  transform: scale(0.85) !important;
  transition: transform 0.1s ease-in !important;
}

@keyframes sendPress {
  0% { transform: scale(1); }
  40% { transform: scale(0.8); }
  100% { transform: scale(1); }
}

/* ── 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;
}
.wa-link{color:#00a0ae;text-decoration:underline;cursor:default}

/* ── Buyer-view variant (swaps sides) ──────────────────────── */

.wa-replay--buyer-view .wa-replay__msg--them {
  background: #dcf8c6;
  align-self: flex-end;
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: 0;
}

.wa-replay--buyer-view .wa-replay__msg--me {
  background: #fff;
  align-self: flex-start;
  border-top-left-radius: 0;
  border-top-right-radius: var(--radius-sm);
}

.wa-replay--buyer-view .wa-replay__typing {
  align-self: flex-start;
  border-top-left-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;
  height: 526px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.45),
    0 0 80px rgba(41, 92, 69, 0.15);
  border-color: transparent;
}

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

/* ── Feature page variant ───────────────────────────────────── */

.wa-replay--feature {
  max-width: 380px;
}

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

@media (prefers-reduced-motion: reduce) {
  .wa-replay__msg {
    animation: none;
  }
  .wa-replay__typing span {
    animation: none;
    opacity: 0.6;
  }
  .wa-replay__input-bar--streaming .wa-replay__input-cursor,
  .wa-replay__input-bar--idle .wa-replay__input-cursor {
    animation: none;
    opacity: 0;
  }
  .wa-replay__input-bar--done .wa-replay__input-send {
    animation: none;
    background: #075e54;
    color: #fff;
  }
}

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

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

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

/* ── Message Meta (timestamp + checkmarks) ──────────────────── */

.wa-replay__msg {
  position: relative;
}

.wa-replay__msg-meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  margin-left: 8px;
  position: relative;
  top: 5px;
}

.wa-replay__msg-time {
  font-size: 11px;
  color: rgba(92, 107, 115, 0.6);
  white-space: nowrap;
}

.wa-replay__msg--me .wa-replay__msg-time {
  color: rgba(92, 107, 115, 0.55);
}

.wa-replay__checks {
  display: inline-flex;
  align-items: center;
}

.wa-replay__checks--sent {
  color: rgba(92, 107, 115, 0.55);
}

.wa-replay__checks--delivered {
  color: rgba(92, 107, 115, 0.55);
}

.wa-replay__checks--read {
  color: #53bdeb;
}

.wa-replay__checks--unread {
  color: rgba(92, 107, 115, 0.55);
}

/* ── Date Divider ───────────────────────────────────────────── */

.wa-replay__date-divider {
  text-align: center;
  color: rgba(92, 107, 115, 0.65);
  font-size: 12.5px;
  padding: 6px 0;
  position: relative;
  margin: 4px 0;
}

.wa-replay__date-divider::before,
.wa-replay__date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 50px);
  height: 1px;
  background: rgba(92, 107, 115, 0.15);
}

.wa-replay__date-divider::before {
  right: calc(50% + 50px);
}

.wa-replay__date-divider::after {
  left: calc(50% + 50px);
}

.wa-replay__date-divider span {
  background: rgba(241, 237, 229, 0.9);
  padding: 3px 12px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ── Voice Note ─────────────────────────────────────────────── */

.wa-replay__voice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
}

.wa-replay__voice-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #54656f;
}

.wa-replay__voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 20px;
}

.wa-replay__voice-waveform span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
}

.wa-replay__voice-duration {
  font-size: 11px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* ── Image ──────────────────────────────────────────────────── */

.wa-replay__image img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
}

.wa-replay__image-caption {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

/* ── Document ───────────────────────────────────────────────── */

.wa-replay__document {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-replay__doc-icon {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #54656f;
  opacity: 0.8;
}

.wa-replay__doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wa-replay__doc-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-replay__doc-meta {
  font-size: 11px;
  opacity: 0.6;
}

/* ── Gallery ────────────────────────────────────────────────── */

.wa-replay__gallery {
  max-width: 260px;
}

.wa-replay__gallery-grid {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  overflow: hidden;
}

.wa-replay__gallery-grid--1 { grid-template-columns: 1fr; }
.wa-replay__gallery-grid--2 { grid-template-columns: 1fr 1fr; }
.wa-replay__gallery-grid--3 { grid-template-columns: 1fr 1fr; }
.wa-replay__gallery-grid--4 { grid-template-columns: 1fr 1fr; }

.wa-replay__gallery-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wa-replay__gallery-grid--3 img:first-child {
  grid-column: 1 / -1;
  height: 100px;
}
