/* ================================================================
   V42 — WHATSAPP EXACT MESSAGE INTERACTIONS (PC & MOBILE 100% PARITY)
   1. Message Hover Emoji Circle Button 🙂 & Chevron ⌵ (PC)
   2. Floating Reaction Pill Bar (👍 ❤️ 😂 😮 😢 🙏 ➕) with scale bounce
   3. WhatsApp Context Menu (↩ Trả lời, 📋 Sao chép, ☺ Bày tỏ cảm xúc, ↗ Chuyển tiếp, ⭐ Gắn sao, 🗑 Xóa)
   4. Mobile Long-Press with Haptic & Backdrop Sheet
   5. WhatsApp Date Badges & Timestamp Checkmarks (✓✓)
   ================================================================ */

/* --- 1. MESSAGE ROW HOVER TRIGGERS (PC) --- */
.msg-bubble-wrapper {
  position: relative;
}

/* Hover Emoji Button beside bubble */
.wa-msg-hover-emoji-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.2));
  background: var(--wa-bg-header, #202c33);
  color: var(--wa-text-secondary, #8696a0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.2, 0, 0, 1), transform 0.18s cubic-bezier(0.2, 0, 0, 1), background 0.15s ease, color 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 25;
}

:root[data-theme="light"] .wa-msg-hover-emoji-btn {
  background: #ffffff;
  border-color: rgba(11, 20, 26, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  color: #54656f;
}

/* Left side for ME messages, Right side for OTHER messages */
.msg-row.me .wa-msg-hover-emoji-btn {
  left: -38px;
}
.msg-row.other .wa-msg-hover-emoji-btn {
  right: -38px;
}

/* Show on hover for PC / tablets */
@media (min-width: 701px) {
  .msg-row:hover .wa-msg-hover-emoji-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
  }
}

.wa-msg-hover-emoji-btn:hover {
  background: var(--wa-green, #00a884) !important;
  color: #111b21 !important;
  transform: translateY(-50%) scale(1.12) !important;
}

/* Chevron down button in top right of bubble */
.wa-msg-chevron-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--wa-text-secondary, #8696a0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.15s ease;
  z-index: 10;
}

@media (min-width: 701px) {
  .msg-row:hover .wa-msg-chevron-btn {
    opacity: 0.85;
    pointer-events: auto;
  }
}

.wa-msg-chevron-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  color: var(--wa-text-primary, #e9edef);
}

:root[data-theme="light"] .wa-msg-chevron-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #111b21;
}

/* Hide old default clutter action bars */
.msg-actions {
  display: none !important;
}

/* --- 2. FLOATING REACTION PILL BAR (Screenshot 1) --- */
.wa-reaction-pill-bar {
  position: fixed;
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--wa-bg-header, #202c33);
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.25));
  border-radius: 30px;
  padding: 5px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 2147483640;
  animation: waPillPopIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  user-select: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

:root[data-theme="light"] .wa-reaction-pill-bar {
  background: #ffffff;
  border-color: rgba(11, 20, 26, 0.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.wa-reaction-pill-bar.show {
  display: flex !important;
}

@keyframes waPillPopIn {
  0% {
    opacity: 0;
    transform: scale(0.65) translateY(8px);
  }
  75% {
    opacity: 1;
    transform: scale(1.04) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Individual Emoji Button in Pill */
.wa-reaction-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  line-height: 1;
  transition: transform 0.16s cubic-bezier(0.175, 0.885, 0.32, 1.3), background 0.15s ease;
}

.wa-reaction-item:hover {
  transform: scale(1.38) translateY(-6px);
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .wa-reaction-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.wa-reaction-item:active {
  transform: scale(1.15) translateY(-2px);
}

/* The Plus + button at the end of reaction pill */
.wa-reaction-item.wa-reaction-more {
  font-size: 16px;
  color: var(--wa-text-secondary, #8696a0);
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.3));
  border-radius: 50%;
  width: 32px;
  height: 32px;
  margin-left: 2px;
}

.wa-reaction-item.wa-reaction-more:hover {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.12);
  color: var(--wa-text-primary, #e9edef);
}

/* --- 3. WHATSAPP CONTEXT MENU (Screenshot 1) --- */
.wa-msg-context-menu {
  position: fixed;
  display: none;
  flex-direction: column;
  background: var(--wa-bg-header, #202c33);
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.2));
  border-radius: 12px;
  min-width: 190px;
  max-width: 240px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 2147483645;
  animation: waMenuSlideIn 0.18s cubic-bezier(0.2, 0, 0, 1) forwards;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

:root[data-theme="light"] .wa-msg-context-menu {
  background: #ffffff;
  border-color: rgba(11, 20, 26, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.wa-msg-context-menu.show {
  display: flex !important;
}

@keyframes waMenuSlideIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.wa-menu-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--wa-text-primary, #e9edef);
  font-size: 13.5px;
  font-weight: 450;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  width: 100%;
  box-sizing: border-box;
}

:root[data-theme="light"] .wa-menu-action-item {
  color: #111b21;
}

.wa-menu-action-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .wa-menu-action-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.wa-menu-action-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--wa-text-secondary, #8696a0);
  transition: color 0.14s ease;
}

.wa-menu-action-item:hover svg {
  color: var(--wa-text-primary, #e9edef);
}

:root[data-theme="light"] .wa-menu-action-item:hover svg {
  color: #111b21;
}

/* Danger / Delete item */
.wa-menu-action-item.danger {
  color: #ef4444 !important;
}

.wa-menu-action-item.danger svg {
  color: #ef4444 !important;
}

.wa-menu-action-item.danger:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

/* --- 4. MOBILE BACKDROP & BOTTOM SHEET (Di động) --- */
.wa-msg-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 2147483630;
}

.wa-msg-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 700px) {
  .wa-reaction-pill-bar {
    border-radius: 36px;
    padding: 6px 14px;
    gap: 8px;
  }
  .wa-reaction-item {
    width: 38px;
    height: 38px;
    font-size: 26px;
  }
  .wa-msg-context-menu {
    min-width: 220px;
    border-radius: 14px;
    padding: 8px;
  }
  .wa-menu-action-item {
    padding: 10px 14px;
    font-size: 14.5px;
  }
}

/* --- 5. WHATSAPP DATE PILL BADGES (Screenshot 2) --- */
.date-divider {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 14px 0 10px !important;
  width: 100% !important;
}

.date-divider span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--wa-date-badge-bg, #182229) !important;
  color: var(--wa-text-secondary, #8696a0) !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  padding: 5px 14px !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25) !important;
  letter-spacing: 0.2px !important;
  text-transform: capitalize !important;
}

:root[data-theme="light"] .date-divider span {
  background: #ffffff !important;
  color: #54656f !important;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.12) !important;
}

/* --- 6. WHATSAPP DOUBLE CHECKMARKS (✓✓) (Screenshot 2) --- */
.msg-time {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  font-size: 11px !important;
  color: var(--wa-text-secondary, #8696a0) !important;
}

.msg-status-tick {
  display: inline-flex;
  align-items: center;
  color: #53bdeb; /* WhatsApp blue / green tick */
  font-size: 13px;
  font-weight: bold;
  letter-spacing: -3px;
  margin-left: 2px;
}

/* Reactions badge under message bubble */
.reactions-badge {
  display: inline-flex !important;
  align-items: center !important;
  background: var(--wa-bg-header, #202c33) !important;
  border: 1px solid var(--wa-border, rgba(134, 150, 160, 0.2)) !important;
  border-radius: 14px !important;
  padding: 1px 6px !important;
  font-size: 13px !important;
  margin-top: -8px !important;
  align-self: flex-start !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) !important;
  cursor: pointer !important;
  transition: transform 0.15s ease !important;
}

.reactions-badge:hover {
  transform: scale(1.08) !important;
}

.msg-row.me .reactions-badge {
  align-self: flex-end !important;
}

/* --- 7. STRICT SUPPRESSION OF LEGACY ZALO LIKE & TEXT TICKS --- */
/* Completely hide legacy floating black pill and legacy like button */
.msg-actions,
.zalo-primary-like-v711,
.zalo-reaction-picker-v2,
.reaction-popup,
.reaction-trigger,
.v2415-quote-selection-bar {
  display: none !important;
}

/* Hide any text like 'Chưa nhận', 'Đã nhận', 'Đã xem' from any legacy script */
.msg-status-check,
.msg-status span:not(.wa-msg-ticks):not(.wa-group-seen-count) {
  display: none !important;
}

.msg-status.wa-msg-status {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 1px 0 0 auto !important;
  min-height: unset !important;
  height: auto !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
}

.wa-msg-ticks {
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: -2px !important;
  line-height: 1 !important;
  display: inline-block !important;
  margin-left: 2px !important;
  vertical-align: middle !important;
}

.wa-msg-ticks.wa-seen-ticks {
  color: #53bdeb !important; /* WhatsApp iconic double blue ticks */
}

.wa-msg-ticks.wa-delivered-ticks,
.wa-msg-ticks.wa-sent-ticks {
  color: #8696a0 !important; /* WhatsApp gray ticks */
}

:root[data-theme="light"] .wa-msg-ticks.wa-delivered-ticks,
:root[data-theme="light"] .wa-msg-ticks.wa-sent-ticks {
  color: #667781 !important;
}

.wa-group-seen-count {
  font-size: 11px !important;
  color: #8696a0 !important;
  margin-left: 3px !important;
}
