/* =========================================================
   WHATSAPP LIVE CHAT - VISITOR MOBILE & DESKTOP STYLES
   Ultra-fast, zero-dependency, authentic WhatsApp Clone
========================================================= */

:root {
  --wa-header-bg: #075e54;
  --wa-header-green: #128c7e;
  --wa-light-green: #25d366;
  --wa-accent: #00a884;
  --wa-body-bg: #efeae2;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #d9fdd3;
  --wa-text-primary: #111b21;
  --wa-text-secondary: #667781;
  --wa-tick-blue: #53bdeb;
  --wa-tick-gray: #8696a0;
  --wa-input-bg: #ffffff;
  --wa-border-color: #e9edef;
  --wa-system-pill: rgba(255, 255, 255, 0.92);
  --wa-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --app-height: 100vh;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #d1d7db;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Container responsive sizing */
.chat-container {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--wa-body-bg);
  background-image: url('/assets/whatsapp-bg.svg');
  background-repeat: repeat;
  background-size: 380px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

@media (min-width: 600px) {
  .chat-container {
    height: 92vh;
    max-height: 840px;
    border-radius: 12px;
  }
}

/* ---------------- HEADER ---------------- */
.chat-header {
  height: 60px;
  background-color: var(--wa-header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 4px;
  color: #ffffff;
  z-index: 20;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  transition: background 0.2s;
}

.btn-icon:active {
  background: rgba(255, 255, 255, 0.15);
}

.back-btn {
  padding: 6px;
}

.header-avatar-container {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
}

.online-indicator {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 12px;
  height: 12px;
  background-color: var(--wa-light-green);
  border: 2px solid var(--wa-header-bg);
  border-radius: 50%;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

.header-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
}

.agent-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.agent-name {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.verified-badge {
  flex-shrink: 0;
}

.agent-status {
  font-size: 12px;
  color: #d1f2eb;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--wa-light-green);
  display: inline-block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ---------------- ENCRYPTION NOTICE ---------------- */
.encryption-notice {
  background-color: rgba(254, 236, 172, 0.95);
  color: #54656f;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.encryption-notice svg {
  color: #8696a0;
  flex-shrink: 0;
}

/* ---------------- CHAT FEED ---------------- */
.chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.date-divider {
  display: flex;
  justify-content: center;
  margin: 6px 0 10px;
}

.date-divider span {
  background-color: var(--wa-system-pill);
  color: var(--wa-text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: var(--wa-shadow);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ---------------- MESSAGE BUBBLES ---------------- */
.msg-row {
  display: flex;
  width: 100%;
  margin-bottom: 4px;
  animation: fadeInMsg 0.22s ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.incoming {
  justify-content: flex-start;
}

.msg-row.outgoing {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 82%;
  min-width: 80px;
  padding: 6px 9px 6px 9px;
  position: relative;
  font-size: 14.2px;
  line-height: 19px;
  color: var(--wa-text-primary);
  box-shadow: var(--wa-shadow);
  word-wrap: break-word;
  border-radius: 8px;
}

/* Tail shapes */
.msg-row.incoming .msg-bubble {
  background-color: var(--wa-bubble-in);
  border-top-left-radius: 0px;
}

.msg-row.outgoing .msg-bubble {
  background-color: var(--wa-bubble-out);
  border-top-right-radius: 0px;
}

/* Bubble content text */
.msg-text {
  white-space: pre-line;
  word-break: break-word;
}

.msg-text strong {
  font-weight: 700;
}

/* Message Meta (time & ticks) */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  float: right;
  margin-left: 10px;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--wa-text-secondary);
  user-select: none;
}

.msg-ticks {
  display: inline-flex;
}

.msg-ticks svg {
  color: var(--wa-tick-blue);
}

.msg-ticks.delivered svg {
  color: var(--wa-tick-gray);
}

/* ---------------- MEDIA IN BUBBLE ---------------- */
.msg-media-wrap {
  margin: -3px -6px 4px -6px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #000000;
  position: relative;
}

.msg-image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.msg-image:hover {
  transform: scale(1.02);
}

.msg-video {
  width: 100%;
  max-height: 280px;
  display: block;
  border-radius: 6px;
  background: #000;
}

.msg-caption {
  font-size: 13.5px;
  line-height: 18px;
  margin-top: 4px;
  padding: 0 2px;
}

/* ---------------- VOICE NOTE PLAYER ---------------- */
.voice-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px 0;
  min-width: 210px;
}

.voice-avatar-mic {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.voice-avatar-mic img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.voice-mic-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #53bdeb;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
}

.voice-mic-badge svg {
  width: 10px;
  height: 10px;
  fill: #fff;
}

.voice-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.voice-track-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-play-btn {
  background: var(--wa-light-green);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.voice-play-btn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* Simulated Waveform Bar Scrubber */
.waveform-bars {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2.2px;
  cursor: pointer;
  padding: 0 2px;
}

.waveform-bar {
  flex: 1;
  background-color: #aebac1;
  border-radius: 2px;
  transition: background-color 0.15s, height 0.2s;
}

.waveform-bar.played {
  background-color: var(--wa-header-green);
}

.voice-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--wa-text-secondary);
  padding: 0 2px;
}

.speed-pill {
  background: rgba(0,0,0,0.06);
  border: none;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--wa-text-secondary);
  padding: 1px 6px;
  border-radius: 10px;
  cursor: pointer;
}

/* ---------------- TYPING BUBBLE ---------------- */
.typing-bubble-container {
  display: flex;
  margin-bottom: 6px;
  padding-left: 2px;
  animation: fadeInMsg 0.2s ease-out;
}

.typing-bubble {
  background: var(--wa-bubble-in);
  border-radius: 8px;
  border-top-left-radius: 0px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--wa-shadow);
}

.typing-label {
  font-size: 12.5px;
  color: var(--wa-text-secondary);
  font-style: italic;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
}

.typing-dots span {
  width: 5.5px;
  height: 5.5px;
  background-color: #8696a0;
  border-radius: 50%;
  animation: dotPulse 1.4s infinite ease-in-out;
}

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

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

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* ---------------- PHONE PROMPT CARD ---------------- */
.phone-prompt-card {
  position: absolute;
  bottom: 110px;
  left: 12px;
  right: 12px;
  background: #ffffff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  border: 1px solid var(--wa-border-color);
  z-index: 35;
  animation: slideUpPrompt 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpPrompt {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.prompt-close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 20px;
  color: #8696a0;
  cursor: pointer;
}

.prompt-content {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.prompt-icon {
  font-size: 24px;
}

.prompt-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--wa-text-primary);
  margin-bottom: 2px;
}

.prompt-desc {
  font-size: 12px;
  color: var(--wa-text-secondary);
  line-height: 16px;
}

.prompt-form {
  display: flex;
  gap: 8px;
}

.phone-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f0f2f5;
  border-radius: 8px;
  padding: 0 10px;
  border: 1px solid #d1d7db;
}

.phone-prefix {
  font-size: 14px;
  margin-right: 6px;
}

.phone-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 13.5px;
  outline: none;
  color: var(--wa-text-primary);
}

.prompt-submit-btn {
  background: var(--wa-light-green);
  color: #ffffff;
  border: none;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.prompt-submit-btn:hover {
  background: #20ba5a;
}

/* ---------------- QUICK REPLIES BAR ---------------- */
.quick-replies-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 12px;
  background: rgba(239, 234, 226, 0.95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-top: 1px solid rgba(0,0,0,0.06);
  z-index: 15;
  scrollbar-width: none;
  flex-shrink: 0;
}

.quick-replies-bar::-webkit-scrollbar {
  display: none;
}

.quick-chip {
  background: #ffffff;
  color: var(--wa-header-bg);
  border: 1px solid rgba(7, 94, 84, 0.25);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
  user-select: none;
}

.quick-chip:hover, .quick-chip:active {
  background: #e7f7f3;
  border-color: var(--wa-header-bg);
  transform: scale(0.98);
}

/* ---------------- CHAT INPUT BAR ---------------- */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)) 8px;
  background: transparent;
  z-index: 20;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.input-container {
  flex: 1 1 0%;
  min-width: 0; /* CRITICAL: Prevents flex child from overflowing */
  background: var(--wa-input-bg);
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 3px 6px;
  box-shadow: var(--wa-shadow);
  border: 1px solid var(--wa-border-color);
  box-sizing: border-box;
}

.input-container textarea {
  flex: 1 1 0%;
  min-width: 0; /* CRITICAL: Prevents textarea default width from overflowing */
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 15px;
  line-height: 20px;
  max-height: 90px;
  min-height: 22px;
  padding: 5px 6px;
  color: var(--wa-text-primary);
  box-sizing: border-box;
}

.input-container textarea::placeholder {
  color: #8696a0;
}

/* Compact, responsive action buttons inside input pill */
.input-container .btn-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 4px;
  color: #8696a0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.input-container .btn-icon svg {
  width: 20px;
  height: 20px;
  fill: #8696a0;
}

.input-container .btn-icon:hover,
.input-container .btn-icon:active {
  background: rgba(0, 0, 0, 0.05);
}

#visitorPasteBtn {
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Prominent, fixed-size send button that NEVER leaves the screen */
.send-action-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  border-radius: 50%;
  background: var(--wa-header-green);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.15s, background 0.2s;
  flex-shrink: 0; /* NEVER shrink or get pushed out */
  margin-bottom: 1px;
}

.send-action-btn:hover {
  background: var(--wa-header-bg);
}

.send-action-btn:active {
  transform: scale(0.94);
}

.send-action-btn svg {
  width: 20px;
  height: 20px;
}

/* Mobile Screens (<= 420px): Super optimized spacing */
@media (max-width: 420px) {
  .chat-input-bar {
    gap: 5px;
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom, 0px)) 6px;
  }
  .input-container {
    padding: 2px 4px;
  }
  .input-container .btn-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    padding: 3px;
  }
  .input-container .btn-icon svg {
    width: 18px;
    height: 18px;
  }
  .send-action-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
  }
  .send-action-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Extra small mobile screens (<= 360px): Auto-collapse mic when typing */
@media (max-width: 360px) {
  .chat-input-bar.has-text #visitorMicBtn {
    display: none;
  }
}

/* ---------------- LIGHTBOX ---------------- */
.media-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.lightbox-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
}

.lightbox-body img,
.lightbox-body video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ---------------- PWA INSTALL BANNER ---------------- */
.pwa-install-banner {
  background-color: #128c7e;
  color: #ffffff;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  z-index: 50;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  animation: slideDownBanner 0.3s ease-out;
}

@keyframes slideDownBanner {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.pwa-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pwa-app-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  flex-shrink: 0;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pwa-banner-text strong {
  font-size: 13px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-banner-text span {
  font-size: 11px;
  color: #d1f2eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-pwa-install {
  background: var(--wa-light-green);
  color: #ffffff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.15s, background 0.2s;
  white-space: nowrap;
}

.btn-pwa-install:active {
  transform: scale(0.95);
}

.btn-pwa-dismiss {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0.8;
  line-height: 1;
}

.btn-pwa-dismiss:hover {
  opacity: 1;
}

/* ---------------- NOTIFICATION PERMISSION BANNER ---------------- */
.notif-permission-banner {
  background-color: #075e54;
  color: #ffffff;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  z-index: 55;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  animation: slideDownBanner 0.3s ease-out;
}

.notif-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.notif-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.notif-banner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.notif-banner-text strong {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-banner-text span {
  font-size: 11px;
  color: #d1fae5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-notif-enable {
  background-color: #25d366;
  color: #0b141a;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.15s, background-color 0.2s;
  white-space: nowrap;
}

.btn-notif-enable:active {
  transform: scale(0.95);
}

.btn-notif-dismiss {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.btn-notif-dismiss:hover {
  color: #ffffff;
}

/* ---------------- VISITOR VOICE RECORDING BAR ---------------- */
.visitor-voice-bar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: #ffffff;
  border-radius: 28px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  border: 1px solid var(--wa-border-color);
  z-index: 30;
  animation: slideUpPrompt 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.voice-record-pulse {
  width: 12px;
  height: 12px;
  background-color: #ea4335;
  border-radius: 50%;
  animation: pulse-dot 1s infinite ease-in-out;
  flex-shrink: 0;
}

.voice-record-timer {
  font-size: 14px;
  font-weight: 700;
  color: #ea4335;
  font-variant-numeric: tabular-nums;
}

.voice-record-label {
  font-size: 13px;
  color: var(--wa-text-secondary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visitor-record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-visitor-cancel-record {
  background: #f0f2f5;
  border: 1px solid #d1d7db;
  color: #54656f;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-visitor-cancel-record:hover {
  background: #e4e6eb;
}

.btn-visitor-send-record {
  background: var(--wa-light-green);
  border: none;
  color: #ffffff;
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.15s, background 0.2s;
}

.btn-visitor-send-record:hover {
  background: #20ba5a;
}

.btn-visitor-send-record:active {
  transform: scale(0.96);
}

/* ---------------- WHATSAPP FLOATING IN-APP POPUP NOTIFICATION ---------------- */
.wa-popup-notification {
  position: absolute;
  top: 68px;
  left: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 168, 132, 0.28);
  z-index: 99;
  cursor: pointer;
  animation: popupSlideDown 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.wa-popup-notification:hover {
  transform: translateY(2px);
}

.wa-popup-notification.dismissing {
  opacity: 0;
  transform: translateY(-20px);
}

@keyframes popupSlideDown {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wa-popup-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.wa-popup-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #00a884;
}

.wa-popup-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: #25d366;
  border: 2px solid #fff;
  border-radius: 50%;
}

.wa-popup-content {
  flex: 1;
  min-width: 0;
}

.wa-popup-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.wa-popup-header-row strong {
  font-size: 13.5px;
  color: #111b21;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-popup-time {
  font-size: 11px;
  color: #00a884;
  font-weight: 600;
  flex-shrink: 0;
}

.wa-popup-body {
  font-size: 12.5px;
  color: #54656f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.wa-popup-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #8696a0;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-popup-close:hover {
  color: #111b21;
  background: #f0f2f5;
}

/* Message Bubble Actions (Copy & Forward) */
.msg-row {
  position: relative;
}

.msg-row:hover .msg-bubble-actions {
  opacity: 1;
  pointer-events: auto;
}

.msg-bubble-actions {
  position: absolute;
  top: -8px;
  right: 12px;
  display: flex;
  gap: 3px;
  background: #ffffff;
  padding: 2px 5px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.14);
  border: 1px solid #d1d7db;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 5;
}

.msg-row.incoming .msg-bubble-actions {
  left: 12px;
  right: auto;
}

.btn-bubble-action {
  background: transparent;
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.btn-bubble-action:hover {
  background: #f0f2f5;
}

.msg-forwarded-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #667781;
  font-style: italic;
  margin-bottom: 3px;
}

/* ---------------- WHATSAPP INTERACTIVE QUICK-REPLY POPUP MODAL ---------------- */
.wa-interactive-popup-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 20, 26, 0.68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: waBackdropFadeIn 0.22s ease-out forwards;
}

@keyframes waBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wa-interactive-popup {
  width: 100%;
  max-width: 420px;
  background: #efeae2;
  background-image: radial-gradient(#d5cdc2 1.2px, transparent 1.2px);
  background-size: 16px 16px;
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: waPopupSlideIn 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  position: relative;
}

@keyframes waPopupSlideIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.93);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wa-popup-header {
  background: var(--wa-header-green);
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wa-popup-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wa-popup-header-left .wa-popup-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.wa-popup-header-left .wa-popup-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
}

.wa-popup-online-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 11px;
  height: 11px;
  background: #25d366;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.wa-popup-header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wa-popup-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.wa-popup-sender-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-popup-status-subtitle {
  font-size: 11.5px;
  color: #d1f2eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-popup-modal-close {
  background: rgba(255, 255, 255, 0.16);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.wa-popup-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.wa-popup-body-area {
  padding: 16px 14px 12px 14px;
  max-height: 250px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.wa-popup-bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.wa-popup-bubble-box {
  background: #ffffff;
  border-radius: 4px 14px 14px 14px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(11, 20, 26, 0.15);
  max-width: 95%;
  word-wrap: break-word;
  position: relative;
}

.wa-popup-bubble-sender {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--wa-header-green);
  margin-bottom: 4px;
}

.wa-popup-msg-content {
  font-size: 14px;
  line-height: 1.42;
  color: #111b21;
}

.wa-popup-msg-content img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  margin-top: 4px;
  object-fit: cover;
  display: block;
}

.wa-popup-msg-content video {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  margin-top: 4px;
  display: block;
}

.wa-popup-msg-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.wa-popup-time-text {
  font-size: 10.5px;
  color: #667781;
}

.wa-popup-reply-bar {
  background: #f0f2f5;
  border-top: 1px solid #e9edef;
  padding: 10px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-popup-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

#waInteractiveInput {
  flex: 1;
  height: 42px;
  background: #ffffff;
  border: 1px solid #d1d7db;
  border-radius: 22px;
  padding: 0 14px;
  font-size: 14px;
  color: #111b21;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#waInteractiveInput:focus {
  border-color: #00a884;
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
}

.wa-popup-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  border-radius: 50%;
  background: var(--wa-header-green);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s, background 0.2s;
}

.wa-popup-send-btn:hover {
  background: #008069;
}

.wa-popup-send-btn:active {
  transform: scale(0.92);
}

.wa-popup-action-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.wa-popup-open-chat-link {
  background: none;
  border: none;
  color: #008069;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.wa-popup-open-chat-link:hover {
  background: rgba(0, 128, 105, 0.08);
}

.wa-popup-hint {
  font-size: 11px;
  color: #8696a0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Mobile optimizations for Interactive Popup */
@media (max-width: 480px) {
  .wa-interactive-popup-backdrop {
    padding: 10px;
    align-items: flex-end; /* Mobile bottom sheet style */
  }

  .wa-interactive-popup {
    border-radius: 20px 20px 14px 14px;
    margin-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}



