﻿/* ===================================
   CHAT CSS - ORGANIZZAZIONE COMPLETA
   
   STRUTTURA DEL FILE:
   1. Variabili CSS e colori
   2. Chat Header & Messages
   3. WhatsApp Layout
   4. WhatsApp Sidebar
   5. WhatsApp Main Area
   6. WhatsApp Chat Header & Contact
   7. WhatsApp Input & Send
   8. WAHA Components
   9. WhatsApp QR Modal
   10. Responsive & Media Query
   
   OTTIMIZZAZIONI APPLICATE:
   âœ“ Centralizzate tutte le variabili CSS
   âœ“ Raggruppati stili correlati per sezione
   âœ“ Rimossi stili duplicati
   âœ“ Migliorata leggibilitÃ  con commenti chiari
   âœ“ Ottimizzati selector per performance
   âœ“ Aggiunto supporto dark mode completo
   =================================== */

/* === VARIABILI CSS PRINCIPALI === */
:root {
  --waha-green: #25d366;
  --waha-green-dark: #128c7e;
  --waha-green-light: #dcf8c6;
  --waha-teal: #00a884;
  --waha-teal-dark: #008069;
  --waha-gray: #f0f2f5;
  --waha-gray-dark: #8696a0;
  --waha-border: #e9edef;
  --chat-bg-light: #e5ddd5;
  --chat-bg-dark: #0b141a;
  --message-bg-light: #ffffff;
  --message-bg-dark: #2a3942;
  --message-out-light: #d9fdd3;
  --message-out-dark: #005c4b;
  --shadow-light: rgba(11, 20, 26, 0.13);
  --shadow-dark: rgba(0, 0, 0, 0.4);
}

/* ===================================
   SEZIONE 1: CHAT HEADER & MESSAGES
   =================================== */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  background: var(--bg-primary);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 10px 16px;
  background: #f0f2f5;
  border-bottom: 1px solid var(--waha-border);
  box-shadow: none;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  backdrop-filter: none;
  min-height: 60px;
}

[data-theme="dark"] .chat-header {
  background: #202c33;
  border-bottom-color: #2a3942;
}

.chat-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-header-info h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.chat-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.chat-header-actions {
  display: flex;
  gap: 0.25rem;
}

.chat-search {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border-bottom: none;
}

.chat-search input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 20px;
  background: #ffffff;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-size: 13px;
}

.chat-search input:focus {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transform: none;
  outline: none;
}

.chat-search input:hover {
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--chat-bg-light);
  background-image: 
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 20px);
}

[data-theme="dark"] .chat-messages {
  background: var(--chat-bg-dark);
  background-image: 
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.01) 10px, rgba(255,255,255,0.01) 20px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(0,0,0,0.15) 10px, rgba(0,0,0,0.15) 20px);
}

.chat-messages .loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 0.5rem;
}

/* â”€â”€ Message skeleton loader â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.msg-skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  width: 100%;
  box-sizing: border-box;
}

.msg-skeleton-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.msg-skeleton-row.right { flex-direction: row-reverse; }

.msg-skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(90deg, #e8eaed 25%, #d4d6da 50%, #e8eaed 75%);
  background-size: 300% 100%;
  animation: msg-shimmer 1.4s ease-in-out infinite;
}

.msg-skeleton-bubble {
  border-radius: 12px;
  background: linear-gradient(90deg, #e8eaed 25%, #d4d6da 50%, #e8eaed 75%);
  background-size: 300% 100%;
  animation: msg-shimmer 1.4s ease-in-out infinite;
  min-height: 38px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  box-sizing: border-box;
}
.msg-skeleton-row.right .msg-skeleton-bubble {
  background: linear-gradient(90deg, #d4f1c0 25%, #c2e8ac 50%, #d4f1c0 75%);
  background-size: 300% 100%;
  animation: msg-shimmer-green 1.4s ease-in-out infinite;
}

.msg-skeleton-line {
  height: 10px;
  border-radius: 5px;
  background: rgba(0,0,0,0.08);
}

.msg-skeleton-time {
  height: 8px;
  width: 40px;
  border-radius: 4px;
  background: rgba(0,0,0,0.06);
  align-self: flex-end;
  margin-top: 2px;
}

@keyframes msg-shimmer {
  0%   { background-position: 300% 0; }
  100% { background-position: -300% 0; }
}
@keyframes msg-shimmer-green {
  0%   { background-position: 300% 0; }
  100% { background-position: -300% 0; }
}

/* dark mode */
@media (prefers-color-scheme: dark) {
  .msg-skeleton-avatar,
  .msg-skeleton-bubble {
    background: linear-gradient(90deg, #2a2d32 25%, #33363c 50%, #2a2d32 75%) !important;
    background-size: 300% 100% !important;
  }
  .msg-skeleton-row.right .msg-skeleton-bubble {
    background: linear-gradient(90deg, #1a3020 25%, #214028 50%, #1a3020 75%) !important;
    background-size: 300% 100% !important;
  }
  .msg-skeleton-line { background: rgba(255,255,255,0.07); }
  .msg-skeleton-time { background: rgba(255,255,255,0.05); }
}

.date-separator {
  text-align: center;
  margin: 20px 0;
  position: relative;
  display: flex;
  justify-content: center;
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.date-separator::before {
  content: '';
  display: none;
}

.date-separator::after {
  content: attr(data-date);
  background: transparent;
  padding: 6px 14px 7px;
  border-radius: 12px;
  box-shadow: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: #999999;
  position: relative;
  z-index: 1;
  display: inline-block;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .date-separator::after {
  background: transparent;
  color: #999999;
  box-shadow: none;
}

.message {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.35rem;
  max-width: 65%;
  animation: messageIn 0.2s ease;
  padding: 0 0.5rem;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.message-incoming {
  align-self: flex-start;
  max-width: 72%;
}

.message-incoming .message-sender {
  display: block;
}

.message-outgoing {
  align-self: flex-end;
  max-width: 72%;
}

.message-sender {
  font-size: 10px;
  font-weight: 400;
  color: #999999;
  margin-bottom: 1px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-bubble {
  background: #ffffff;
  padding: 8px 10px 7px 10px;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.13);
  position: relative;
  word-wrap: break-word;
  width: fit-content;
  transition: box-shadow 0.15s ease;
  max-width: 100%;
}

.message-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
}

.message-incoming .message-bubble::before {
  left: -8px;
  top: 0;
  border-width: 0 9px 9px 0;
  border-color: transparent #ffffff transparent transparent;
}

[data-theme="dark"] .message-incoming .message-bubble::before {
  border-color: transparent #202c33 transparent transparent;
}

.message-outgoing .message-bubble::before {
  right: -8px;
  top: 0;
  border-width: 9px 9px 0 0;
  border-color: #d9fdd3 transparent transparent transparent;
}

[data-theme="dark"] .message-outgoing .message-bubble::before {
  border-color: #005c4b transparent transparent transparent;
}

.message-bubble:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.message-outgoing .message-bubble {
  background: #d9fdd3;
  color: #111b21;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.13);
}

[data-theme="dark"] .message-bubble {
  background: #202c33;
  color: #e9edef;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

[data-theme="dark"] .message-bubble:hover {
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}

[data-theme="dark"] .message-outgoing .message-bubble {
  background: #005c4b;
  color: #e9edef;
}

[data-theme="dark"] .message-time {
  color: rgba(233, 237, 239, 0.6);
}

.message-text {
  font-size: 14.4px;
  line-height: 20px;
  color: #111b21;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  letter-spacing: 0.01em;
}

.message-outgoing .message-text {
  color: #111b21;
}

[data-theme="dark"] .message-text {
  color: #e9edef;
}

[data-theme="dark"] .message-outgoing .message-text {
  color: #e9edef;
}

.message-text a {
  color: #027eb5;
  text-decoration: none;
}

.message-text a:hover {
  text-decoration: underline;
}

.message-time {
  font-size: 11px;
  color: #667781;
  margin-top: 2px;
  text-align: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  float: right;
  margin-left: 8px;
  font-weight: 400;
}

[data-theme="dark"] .message-time {
  color: rgba(233, 237, 239, 0.6);
}

.message-media {
  margin-bottom: 0.5rem;
  border-radius: 8px;
  overflow: hidden;
}

.message-media img {
  max-width: 100%;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}

.message-media img:hover {
  opacity: 0.9;
}

.message-media video {
  max-width: 100%;
  display: block;
}

.message-audio audio {
  width: 100%;
  height: 40px;
}

.message-document {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .message-document {
  background: rgba(255, 255, 255, 0.05);
}

.message-document i {
  font-size: 1.5rem;
  color: #667781;
}

.message-document a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
}

.message-document a:hover {
  text-decoration: underline;
}

.message-quoted {
  background: rgba(102, 126, 234, 0.08);
  border-left: 4px solid #667eea;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.message-quoted:hover {
  background: rgba(102, 126, 234, 0.12);
}

[data-theme="dark"] .message-quoted {
  background: rgba(90, 103, 216, 0.12);
  border-left-color: #5a67d8;
}

[data-theme="dark"] .message-quoted:hover {
  background: rgba(90, 103, 216, 0.18);
}

.quoted-sender {
  font-size: 0.75rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.25rem;
}

[data-theme="dark"] .quoted-sender {
  color: #a5b4fc;
}

.quoted-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input input {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: 28px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-input input:focus {
  outline: none;
  border-color: #667eea;
  background: var(--bg-primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), inset 0 1px 3px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #25D366; /* WhatsApp green */
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.chat-send-btn:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.chat-send-btn:active {
  transform: scale(0.95) rotate(0deg);
}

.chat-send-btn i {
  transition: transform 0.3s ease;
}

.chat-send-btn:hover i {
  transform: translateX(2px);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  text-align: center;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state p {
  font-size: 1.1rem;
  margin: 0.5rem 0;
}

.empty-state small {
  font-size: 0.9rem;
  opacity: 0.7;
}

.highlight-search {
  animation: highlight 0.5s ease;
}

@keyframes highlight {
  0%, 100% {
    background: transparent;
  }
  50% {
    background: rgba(255, 235, 59, 0.3);
  }
}

.media-viewer {
  max-width: 90vw;
  max-height: 90vh;
}

.media-viewer .modal-body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: #000;
}

/* ===== Media Gallery Overlay ===== */
.mg-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.mg-topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; z-index: 3;
  background: linear-gradient(180deg, rgba(0,0,0,.6) 0%, transparent 100%);
}
.mg-counter {
  color: #fff; font-size: 14px; font-weight: 500; opacity: .85;
}
.mg-tools {
  display: flex; gap: 6px;
}
.mg-btn {
  background: rgba(255,255,255,.12); border: none; border-radius: 50%;
  width: 40px; height: 40px; color: #fff; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.mg-btn:hover { background: rgba(255,255,255,.25); }
.mg-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 3; background: rgba(255,255,255,.1); border: none;
  border-radius: 50%; width: 48px; height: 48px;
  color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.mg-nav:hover { background: rgba(255,255,255,.25); }
.mg-prev { left: 16px; }
.mg-next { right: 16px; }
.mg-stage {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  overflow: hidden;
}
.mg-image {
  max-width: 90vw; max-height: 88vh;
  object-fit: contain;
  transition: transform .15s ease;
  cursor: default;
}
.mg-video {
  max-width: 90vw; max-height: 88vh;
  outline: none;
}

.mg-task-modal {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.6);
}

.mg-task-modal-card {
  width: 420px;
  max-width: 90vw;
  background: var(--bg-primary, #fff);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.mg-task-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.mg-task-modal-header i {
  color: #25D366;
  font-size: 20px;
}

.mg-task-modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary, #111b21);
}

.mg-task-field {
  margin-bottom: 12px;
}

.mg-task-field label {
  font-size: 12px;
  color: var(--text-secondary, #667781);
  display: block;
  margin-bottom: 4px;
}

.mg-task-title,
.mg-task-desc {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #e9edef);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  background: var(--bg-secondary, #f0f2f5);
  color: var(--text-primary, #111b21);
}

.mg-task-desc {
  resize: vertical;
  min-height: 88px;
}

.mg-task-title:focus,
.mg-task-desc:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.18);
}

.mg-task-attachment-row {
  margin-bottom: 16px;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary, #f0f2f5);
  color: var(--text-secondary, #667781);
  font-size: 13px;
}

.mg-task-attachment-row i {
  color: #25D366;
}

.mg-task-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.mg-task-cancel,
.mg-task-confirm {
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.mg-task-cancel {
  border: 1px solid var(--border-color, #e9edef);
  background: transparent;
  color: var(--text-secondary, #667781);
}

.mg-task-confirm {
  border: none;
  background: #25D366;
  color: #fff;
  font-weight: 600;
}

.mg-task-confirm:disabled {
  opacity: 0.75;
  cursor: default;
}

@media (max-width: 600px) {
  .mg-nav { width: 36px; height: 36px; font-size: 16px; }
  .mg-prev { left: 6px; }
  .mg-next { right: 6px; }
  .mg-btn { width: 34px; height: 34px; font-size: 14px; }
  .mg-topbar { padding: 8px 10px; }
  .mg-task-modal-card {
    width: 100%;
    max-width: 96vw;
    padding: 16px;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .message {
    max-width: 85%;
  }
  
  .chat-header-info h3 {
    font-size: 1rem;
  }
  
  .chat-subtitle {
    font-size: 0.75rem;
  }
}

/* ===================================
   SEZIONE 2: WHATSAPP LAYOUT
   =================================== */

/* ---- WA Chat Navbar (inside whatsapp-layout) ---- */
.wa-chat-navbar {
  width: 68px;
  height: 100%;
  background: #e8e8e8;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  border-right: 1px solid #d1d7db;
}

[data-theme="dark"] .wa-chat-navbar {
  background: #222e35;
  border-right-color: #2a3942;
}

.wa-chat-nav-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 12px;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.wa-chat-nav-top::-webkit-scrollbar { width: 0; }

.wa-chat-nav-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding-bottom: 12px;
}

.wa-chat-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #54656f;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
  padding: 0;
}

[data-theme="dark"] .wa-chat-nav-btn {
  color: #aebac1;
}

.wa-chat-nav-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.wa-chat-nav-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .wa-chat-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.wa-chat-nav-btn.active {
  background: rgba(0, 168, 132, 0.1);
  color: #00a884;
}

[data-theme="dark"] .wa-chat-nav-btn.active {
  background: rgba(0, 168, 132, 0.15);
  color: #00a884;
}

.wa-chat-nav-btn.active svg {
  fill: #00a884;
  color: #00a884;
}

/* Active indicator bar */
.wa-chat-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  border-radius: 0 4px 4px 0;
  background: #00a884;
}

/* WA Chat Nav Avatar */
.wa-chat-nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #00a884;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.15s;
  margin-top: 4px;
}

.wa-chat-nav-avatar:hover {
  opacity: 0.85;
}

.wa-chat-nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Tooltip for nav buttons */
.wa-chat-nav-btn[title]:hover::after,
.wa-chat-nav-avatar[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 100000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.wa-chat-nav-avatar {
  position: relative;
}

.main-content:has(.whatsapp-layout) {
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--chat-bg-light) !important;
  height: calc(100vh - 60px) !important;
  height: calc(100dvh - 60px) !important;
  max-height: calc(100vh - 60px) !important;
  max-height: calc(100dvh - 60px) !important;
}

[data-theme="dark"] .main-content:has(.whatsapp-layout) {
  background: var(--chat-bg-dark) !important;
}

.whatsapp-layout {
  display: flex;
  height: 100%;
  width: 100%;
  background: transparent;
  overflow: hidden;
  position: relative;
}

/* ===================================
   WHATSAPP SIDEBAR
   =================================== */

.whatsapp-sidebar {
  width: 420px;
  height: 100%;
  background: #ffffff;
  border-right: 1px solid #e9edef;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: none;
}

[data-theme="dark"] .whatsapp-sidebar {
  background: #111b21;
  border-right-color: #2a3942;
}

.whatsapp-sidebar-header {
  height: 56px;
  background: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e9edef;
}

[data-theme="dark"] .whatsapp-sidebar-header {
  background: #1f2c34;
  border-bottom: 1px solid rgba(233, 237, 239, 0.08);
}

.whatsapp-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: #111b21;
  cursor: pointer;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .whatsapp-user-info {
  color: #e9edef;
}

/* Total unread badge */
.wa-total-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: #25d366;
  color: #fff;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  margin-left: 4px;
}

@keyframes badgePop {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.whatsapp-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

[data-theme="dark"] .whatsapp-user-avatar {
  background: #00a884;
  color: #fff;
}

.whatsapp-sidebar-actions {
  display: flex;
  gap: 8px;
}

.whatsapp-icon-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  border: none !important;
  background: transparent !important;
  color: #54656f !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.15s ease, background 0.15s ease !important;
  font-size: 16px !important;
  flex-shrink: 0 !important;
}

.whatsapp-icon-btn:hover {
  background: rgba(11, 20, 26, 0.06) !important;
  color: #3b4a54 !important;
}

.whatsapp-icon-btn:active {
  transform: scale(0.95);
}

[data-theme="dark"] .whatsapp-icon-btn {
  color: #aebac1 !important;
}

[data-theme="dark"] .whatsapp-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #d1d7db !important;
}

.whatsapp-search-bar {
  padding: 6px 12px 8px 12px;
  background: #fff;
  border-bottom: none;
}

[data-theme="dark"] .whatsapp-search-bar {
  background: #1f2c34;
  border-bottom: none;
}

/* Chat Filter Tabs */
.chat-filter-tabs {
  display: flex;
  gap: 6px;
  padding: 6px 14px 8px;
  background: #fff;
  border-bottom: 1px solid #e9edef;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-filter-tabs::-webkit-scrollbar {
  display: none;
}

[data-theme="dark"] .chat-filter-tabs {
  background: #1f2c34;
  border-bottom: 1px solid rgba(233, 237, 239, 0.08);
}

.chat-filter-tab {
  padding: 5px 14px;
  border-radius: 18px;
  background: #f0f2f5;
  border: none;
  color: #54656f;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chat-filter-tab:hover {
  background: #e9edef;
  color: #3b4a54;
}

.chat-filter-tab.active {
  background: #e7fcee;
  color: #00a884;
  font-weight: 600;
}

[data-theme="dark"] .chat-filter-tab {
  background: rgba(255,255,255,0.06);
  color: #8696a0;
}

[data-theme="dark"] .chat-filter-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .chat-filter-tab.active {
  background: rgba(0,168,132,0.15);
  color: #00a884;
}

/* Filter tab count badges */
.filter-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0,0,0,0.06);
  color: inherit;
  margin-left: 4px;
  opacity: 0.7;
}
.filter-tab-count:empty {
  display: none;
}
.filter-tab-count.has-count {
  background: #25d366;
  color: #fff;
  opacity: 1;
}
.chat-filter-tab.active .filter-tab-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
  opacity: 1;
}
.chat-filter-tab.active .filter-tab-count.has-count {
  background: #fff;
  color: #00a884;
}
[data-theme="dark"] .filter-tab-count {
  background: rgba(255,255,255,0.08);
}

/* Encryption Badge */
.encryption-badge {
  padding: 10px 16px;
  background: transparent;
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(134,150,160,0.7);
  position: relative;
  z-index: 1;
}

.encryption-badge i {
  color: rgba(134,150,160,0.6);
  font-size: 12px;
}

.encryption-badge .highlight {
  color: #00a884;
  font-weight: 500;
}

[data-theme="light"] .encryption-badge {
  background: transparent;
  border-top: none;
  color: rgba(102,119,129,0.7);
}

[data-theme="light"] .encryption-badge i {
  color: rgba(102,119,129,0.6);
}

/* Connection Status Indicator */
.waha-connection-status-bar {
  padding: 6px 16px;
  background: #fff;
  border-bottom: 1px solid #e9edef;
  border-top: none;
}

[data-theme="dark"] .waha-connection-status-bar {
  background: #1f2c34;
  border-bottom-color: rgba(233,237,239,0.08);
  border-top: none;
}

.waha-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #667781;
}

[data-theme="dark"] .waha-status-indicator {
  color: #aebac1;
}

.waha-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.waha-status-dot.connected {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  animation: pulse-waha-green 2s ease-in-out infinite;
}

.waha-status-dot.disconnected {
  background: #9ca3af;
  box-shadow: none;
  animation: none;
}

.waha-status-dot.scanning {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  animation: pulse-waha-amber 2s ease-in-out infinite;
}

@keyframes pulse-waha-green {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 3px rgba(16, 185, 129, 0.3);
  }
}

@keyframes pulse-waha-amber {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 3px rgba(245, 158, 11, 0.3);
  }
}

.waha-status-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Scheduled Messages Sidebar Section === */
.wa-scheduled-sidebar-section {
  border-bottom: 1px solid #e9edef;
  background: #f0fdf4;
}
[data-theme="dark"] .wa-scheduled-sidebar-section {
  background: #1a2e23;
  border-bottom-color: #2a3942;
}
.wa-scheduled-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.wa-scheduled-sidebar-header:hover {
  background: rgba(37, 211, 102, 0.08);
}
.wa-scheduled-sidebar-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.wa-sched-sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  margin-bottom: 4px;
  border: 1px solid #e5e7eb;
}
[data-theme="dark"] .wa-sched-sidebar-item {
  background: #1f2c34;
  border-color: #2a3942;
}
.wa-sched-sidebar-item:hover {
  background: #dcfce7;
  border-color: #86efac;
}
[data-theme="dark"] .wa-sched-sidebar-item:hover {
  background: #22412e;
  border-color: #34d399;
}
.wa-sched-sidebar-item-main {
  flex: 1;
  min-width: 0;
}
.wa-sched-sidebar-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.wa-sched-sidebar-recipient {
  font-weight: 600;
  font-size: 0.78rem;
  color: #166534;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .wa-sched-sidebar-recipient {
  color: #6ee7b7;
}
.wa-sched-sidebar-time {
  font-size: 0.68rem;
  color: #128c7e;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .wa-sched-sidebar-time {
  color: #34d399;
}
.wa-sched-sidebar-text {
  font-size: 0.76rem;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
[data-theme="dark"] .wa-sched-sidebar-text {
  color: #d1d5db;
}
.wa-sched-sidebar-date {
  font-size: 0.67rem;
  color: #9ca3af;
  margin-top: 2px;
}
.wa-sched-sidebar-cancel {
  background: none;
  border: 1px solid #fca5a5;
  color: #dc2626;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  transition: all 0.2s;
  opacity: 0;
}
.wa-sched-sidebar-item:hover .wa-sched-sidebar-cancel {
  opacity: 1;
}
.wa-sched-sidebar-cancel:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.whatsapp-search-input-wrapper {
  background: #f0f2f5;
  border-radius: 8px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: none;
  transition: all 0.2s ease;
  border: 1.5px solid transparent;
}

.whatsapp-search-input-wrapper:focus-within {
  box-shadow: none;
  background: #fff;
  border-color: #00a884;
}

[data-theme="dark"] .whatsapp-search-input-wrapper {
  background: #202c33;
  box-shadow: none;
  border-color: transparent;
}

[data-theme="dark"] .whatsapp-search-input-wrapper:focus-within {
  box-shadow: none;
  background: #2a3942;
  border-color: #00a884;
}

.whatsapp-search-input-wrapper i {
  color: #8696a0;
  font-size: 14px;
}

.whatsapp-search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  color: #111b21;
  font-size: 14px;
  outline: none;
}

[data-theme="dark"] .whatsapp-search-input-wrapper input {
  color: #e9edef;
}

.whatsapp-search-input-wrapper input::placeholder {
  color: #8696a0;
}

.whatsapp-chat-list {
  flex: 1;
  overflow-y: auto;
  background: #fff;
}

[data-theme="dark"] .whatsapp-chat-list {
  background: #111b21;
}

.chat-list-item {
  display: flex !important;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(233,237,239,0.5);
  transition: background 0.12s ease;
  position: relative;
  width: 100%;
}

.chat-list-item:hover {
  background: #f5f6f6;
  transition: background 0.12s ease;
}

.chat-list-item.active {
  background: #f0f2f5;
}

.chat-list-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #00a884;
  border-radius: 0 3px 3px 0;
}

[data-theme="dark"] .chat-list-item {
  border-bottom-color: rgba(233, 237, 239, 0.06);
}

[data-theme="dark"] .chat-list-item:hover {
  background: #202c33;
}

[data-theme="dark"] .chat-list-item.active {
  background: #2a3942;
}

[data-theme="dark"] .chat-list-item.active::before {
  background: #00a884;
}

.chat-list-item-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #00a884;
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  margin-right: 12px;
  flex-shrink: 0;
  box-shadow: none;
  font-weight: 600;
  overflow: hidden;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .chat-list-item-avatar {
  background: #00a884;
  color: #fff;
}

.chat-list-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1px;
}

.chat-list-name {
  font-weight: 500;
  font-size: 15.5px;
  color: #111b21;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
  flex: 1;
  line-height: 21px;
  padding-right: 8px;
}

[data-theme="dark"] .chat-list-name {
  color: #e9edef;
}

/* Timestamp e preview messaggi */
.chat-list-time {
  font-size: 11px;
  color: #667781;
  white-space: nowrap;
  margin-left: 8px;
  font-weight: 400;
}

[data-theme="dark"] .chat-list-time {
  color: #8696a0;
}

.chat-list-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  gap: 8px;
}

.chat-list-item-preview {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: #667781;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 18px;
  flex: 1;
  min-width: 0;
}

[data-theme="dark"] .chat-list-item-preview {
  color: #8696a0;
}

.chat-list-item-preview i {
  font-size: 14px;
  flex-shrink: 0;
}

.chat-list-item-preview .message-status {
  color: #8696a0;
  margin-right: 2px;
}

[data-theme="dark"] .chat-list-item-preview .message-status {
  color: #8696a0;
}

.chat-list-item-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-unread {
  background: #25d366;
  color: white;
  border-radius: 12px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 5px;
  box-shadow: none;
  margin-left: auto;
  flex-shrink: 0;
}

[data-theme="dark"] .chat-list-unread {
  background: #00a884;
}

.chat-list-unread-dot {
  min-width: 12px;
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
}

.chat-list-empty {
  padding: 40px 20px;
  text-align: center;
  color: #667781;
  font-size: 14px;
}

/* --- Load More Chat Button --- */
.chat-list-load-more {
  padding: 8px 12px;
  text-align: center;
}
.chat-load-more-btn {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #e9edef;
  color: #008069;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}
.chat-load-more-btn:hover {
  background: #d9dee1;
}
body.dark-mode .chat-load-more-btn {
  background: #233138;
  color: #00a884;
}
body.dark-mode .chat-load-more-btn:hover {
  background: #2a3942;
}

/* ===================================
   WHATSAPP MAIN - AREA CONVERSAZIONE
   =================================== */

.whatsapp-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #efeae2;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] .whatsapp-main {
  background: #0b141a;
}

/* WhatsApp Chat Header */
.whatsapp-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #e9edef;
  min-height: 56px;
  flex-shrink: 0;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] .whatsapp-chat-header {
  background: #1f2c34;
  border-bottom-color: rgba(233,237,239,0.08);
}

.whatsapp-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.whatsapp-contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dfe5e7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #54656f;
  font-size: 17px;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.15s ease;
}

.whatsapp-contact-avatar:hover {
  transform: scale(1.04);
}

[data-theme="dark"] .whatsapp-contact-avatar {
  background: #182229;
  color: #8696a0;
}

/* Chat header info - name and status */
.whatsapp-chat-header-info {
  flex: 1;
  min-width: 0;
}

.whatsapp-chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .whatsapp-chat-header-name {
  color: #e9edef;
}

.whatsapp-chat-header-status {
  font-size: 12px;
  color: #667781;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

[data-theme="dark"] .whatsapp-chat-header-status {
  color: #8696a0;
}

/* Online/Offline indicators */
.offline-indicator,
.online-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.offline-indicator {
  background: #8696a0;
}

.online-indicator {
  background: #25d366;
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
  animation: onlinePulse 2.5s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(37,211,102,0.2); }
  50% { box-shadow: 0 0 0 3px rgba(37,211,102,0.1); }
}

.whatsapp-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.whatsapp-status-badge {
  font-size: 12px;
  color: #00a884;
  font-weight: 500;
  margin-right: 8px;
}

.whatsapp-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 4.5%;
  background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Cg fill='none' stroke='%23c8c3ba' stroke-width='0.5' opacity='0.45'%3E%3Cpath d='M12 10h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='42' cy='13' r='4'/%3E%3Cpath d='M42 10v3h2'/%3E%3Crect x='68' y='9' width='5' height='8' rx='1'/%3E%3Ccircle cx='70.5' cy='15' r='.6' fill='%23c8c3ba'/%3E%3Ccircle cx='100' cy='13' r='4'/%3E%3Cpath d='M98 11.5a1 1 0 0 1 2 0M102 11.5a1 1 0 0 1-2 0'/%3E%3Cpath d='M97.5 14.5c1.5 2 3.5 2 5 0'/%3E%3Cpath d='M130 10l1.5 3 3 .5-2 2 .5 3-3-1.5-3 1.5.5-3-2-2 3-.5z'/%3E%3Crect x='155' y='10' width='8' height='6' rx='1'/%3E%3Ccircle cx='159' cy='13' r='1.5'/%3E%3Cpath d='M157 10l1-2h2l1 2'/%3E%3Crect x='185' y='10' width='5' height='4.5' rx='.5'/%3E%3Cpath d='M186 10v-2c0-1.5 3-1.5 3 0v2'/%3E%3Cpath d='M215 8v8'/%3E%3Ccircle cx='214' cy='16' r='1.5'/%3E%3Cpath d='M215 8l3.5-1.5v2l-3.5 1.5'/%3E%3Cpath d='M238 13c0-2 2-3 3-1.5 1-1.5 3-.5 3 1.5s-3 4-3 4-3-2-3-4z'/%3E%3Cpath d='M14 40h4.5c.8 0 1.2.5 1.2 1.2v2.5c0 .8-.4 1.2-1.2 1.2h-1.5l-1.5 1.5v-1.5H14c-.8 0-1.2-.4-1.2-1.2v-2.5c0-.7.4-1.2 1.2-1.2z'/%3E%3Ccircle cx='45' cy='43' r='3.5'/%3E%3Cpath d='M48 46l3 3'/%3E%3Cpath d='M70 38c-3 0-5 3-5 3s2 3 5 3 5-3 5-3-2-3-5-3z'/%3E%3Ccircle cx='70' cy='41' r='1.2'/%3E%3Crect x='95' y='38' width='8' height='6' rx='1'/%3E%3Ccircle cx='98' cy='40.5' r='1'/%3E%3Cpath d='M95 43l2.5-2 2 1.5 1-1 2.5 1.5'/%3E%3Cpath d='M130 43c0-3 2-4.5 4-4.5s4 1.5 4 4.5'/%3E%3Crect x='130' y='42.5' width='2.5' height='3.5' rx='.5'/%3E%3Crect x='135.5' y='42.5' width='2.5' height='3.5' rx='.5'/%3E%3Ccircle cx='162' cy='41' r='4'/%3E%3Cellipse cx='162' cy='41' rx='2' ry='4'/%3E%3Cpath d='M158 41h8'/%3E%3Cpath d='M185 38h5c.3 0 .5.3.5.5v7l-3-2-3 2v-7c0-.2.2-.5.5-.5z'/%3E%3Crect x='213' y='38' width='6' height='6' rx='.5'/%3E%3Cpath d='M213 41h6M215 36v2M217 36v2'/%3E%3Cpath d='M240 36l-2 4.5h3l-2 4.5'/%3E%3Crect x='10' y='68' width='4' height='6' rx='2'/%3E%3Cpath d='M8 73c0 2 2.5 3 4 3s4-1 4-3M12 77v2'/%3E%3Cpath d='M42 68l-5.5 3 2 1.5 3.5-4.5zM38 72.5l1 3 1.5-2'/%3E%3Crect x='65' y='67' width='6' height='8' rx='1'/%3E%3Cpath d='M67 70h2M67 72h2'/%3E%3Ccircle cx='100' cy='71' r='2.5'/%3E%3Cpath d='M103 71h4.5M106 71v2'/%3E%3Cpath d='M130 66a3 3 0 0 0-3 3c0 2.5 3 5 3 5s3-2.5 3-5a3 3 0 0 0-3-3z'/%3E%3Ccircle cx='130' cy='69' r='1' fill='%23c8c3ba'/%3E%3Cpath d='M157 68l4.5 4.5M161.5 72.5c.7.7.3 2-.6 3s-2.2 1.3-3 .6'/%3E%3Cpath d='M188 69c1.5-1.5 3.5-1.5 5 0M191 74c-1.5 1.5-3.5 1.5-5 0M188.5 73.5l4.5-4.5'/%3E%3Cpath d='M215 68h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='242' cy='71' r='4'/%3E%3Cpath d='M242 68v3h2'/%3E%3Cpath d='M12 100h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Crect x='38' y='97' width='5' height='8' rx='1'/%3E%3Ccircle cx='40.5' cy='103' r='.6' fill='%23c8c3ba'/%3E%3Ccircle cx='70' cy='101' r='4'/%3E%3Cpath d='M68 99.5a1 1 0 0 1 2 0M72 99.5a1 1 0 0 1-2 0'/%3E%3Cpath d='M67.5 103c1.5 2 3.5 2 5 0'/%3E%3Cpath d='M100 97l1.5 3 3 .5-2 2 .5 3-3-1.5-3 1.5.5-3-2-2 3-.5z'/%3E%3Crect x='125' y='97' width='8' height='6' rx='1'/%3E%3Ccircle cx='129' cy='100' r='1.5'/%3E%3Cpath d='M127 97l1-2h2l1 2'/%3E%3Crect x='155' y='97' width='5' height='4.5' rx='.5'/%3E%3Cpath d='M156 97v-2c0-1.5 3-1.5 3 0v2'/%3E%3Cpath d='M185 95v8'/%3E%3Ccircle cx='184' cy='103' r='1.5'/%3E%3Cpath d='M185 95l3.5-1.5v2l-3.5 1.5'/%3E%3Cpath d='M210 101c0-2 2-3 3-1.5 1-1.5 3-.5 3 1.5s-3 4-3 4-3-2-3-4z'/%3E%3Ccircle cx='242' cy='101' r='3.5'/%3E%3Cpath d='M245 104l3 3'/%3E%3Cpath d='M14 130h4.5c.8 0 1.2.5 1.2 1.2v2.5c0 .8-.4 1.2-1.2 1.2h-1.5l-1.5 1.5v-1.5H14c-.8 0-1.2-.4-1.2-1.2v-2.5c0-.7.4-1.2 1.2-1.2z'/%3E%3Cpath d='M40 126c-3 0-5 3-5 3s2 3 5 3 5-3 5-3-2-3-5-3z'/%3E%3Ccircle cx='40' cy='129' r='1.2'/%3E%3Crect x='65' y='126' width='8' height='6' rx='1'/%3E%3Ccircle cx='68' cy='128.5' r='1'/%3E%3Cpath d='M65 131l2.5-2 2 1.5 1-1 2.5 1.5'/%3E%3Cpath d='M100 131c0-3 2-4.5 4-4.5s4 1.5 4 4.5'/%3E%3Crect x='100' y='130.5' width='2.5' height='3.5' rx='.5'/%3E%3Crect x='105.5' y='130.5' width='2.5' height='3.5' rx='.5'/%3E%3Ccircle cx='132' cy='129' r='4'/%3E%3Cellipse cx='132' cy='129' rx='2' ry='4'/%3E%3Cpath d='M128 129h8'/%3E%3Cpath d='M155 126h5c.3 0 .5.3.5.5v7l-3-2-3 2v-7c0-.2.2-.5.5-.5z'/%3E%3Crect x='183' y='126' width='6' height='6' rx='.5'/%3E%3Cpath d='M183 129h6M185 124v2M187 124v2'/%3E%3Cpath d='M215 124l-2 4.5h3l-2 4.5'/%3E%3Crect x='237' y='127' width='6' height='8' rx='1'/%3E%3Cpath d='M239 130h2M239 132h2'/%3E%3Crect x='10' y='157' width='4' height='6' rx='2'/%3E%3Cpath d='M8 162c0 2 2.5 3 4 3s4-1 4-3M12 166v2'/%3E%3Cpath d='M42 157l-5.5 3 2 1.5 3.5-4.5zM38 161.5l1 3 1.5-2'/%3E%3Ccircle cx='70' cy='160' r='2.5'/%3E%3Cpath d='M73 160h4.5M76 160v2'/%3E%3Cpath d='M100 155a3 3 0 0 0-3 3c0 2.5 3 5 3 5s3-2.5 3-5a3 3 0 0 0-3-3z'/%3E%3Ccircle cx='100' cy='158' r='1' fill='%23c8c3ba'/%3E%3Cpath d='M127 157l4.5 4.5M131.5 161.5c.7.7.3 2-.6 3s-2.2 1.3-3 .6'/%3E%3Cpath d='M158 158c1.5-1.5 3.5-1.5 5 0M161 163c-1.5 1.5-3.5 1.5-5 0M158.5 162.5l4.5-4.5'/%3E%3Cpath d='M185 157h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='215' cy='160' r='4'/%3E%3Cpath d='M213 158.5a1 1 0 0 1 2 0M217 158.5a1 1 0 0 1-2 0'/%3E%3Cpath d='M212.5 162c1.5 2 3.5 2 5 0'/%3E%3Crect x='238' y='157' width='5' height='8' rx='1'/%3E%3Ccircle cx='240.5' cy='163' r='.6' fill='%23c8c3ba'/%3E%3Cpath d='M12 190h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Cpath d='M42 187l1.5 3 3 .5-2 2 .5 3-3-1.5-3 1.5.5-3-2-2 3-.5z'/%3E%3Crect x='65' y='187' width='8' height='6' rx='1'/%3E%3Ccircle cx='69' cy='190' r='1.5'/%3E%3Cpath d='M67 187l1-2h2l1 2'/%3E%3Crect x='95' y='187' width='5' height='4.5' rx='.5'/%3E%3Cpath d='M96 187v-2c0-1.5 3-1.5 3 0v2'/%3E%3Cpath d='M130 185v8'/%3E%3Ccircle cx='129' cy='193' r='1.5'/%3E%3Cpath d='M130 185l3.5-1.5v2l-3.5 1.5'/%3E%3Cpath d='M155 191c0-2 2-3 3-1.5 1-1.5 3-.5 3 1.5s-3 4-3 4-3-2-3-4z'/%3E%3Ccircle cx='190' cy='191' r='4'/%3E%3Cellipse cx='190' cy='191' rx='2' ry='4'/%3E%3Cpath d='M186 191h8'/%3E%3Cpath d='M213 187h5c.3 0 .5.3.5.5v7l-3-2-3 2v-7c0-.2.2-.5.5-.5z'/%3E%3Crect x='238' y='187' width='6' height='6' rx='.5'/%3E%3Cpath d='M238 190h6M240 185v2M242 185v2'/%3E%3Cpath d='M12 220h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='42' cy='223' r='3.5'/%3E%3Cpath d='M45 226l3 3'/%3E%3Crect x='65' y='218' width='4' height='6' rx='2'/%3E%3Cpath d='M63 223c0 2 2.5 3 4 3s4-1 4-3M67 227v2'/%3E%3Cpath d='M100 218c-3 0-5 3-5 3s2 3 5 3 5-3 5-3-2-3-5-3z'/%3E%3Ccircle cx='100' cy='221' r='1.2'/%3E%3Crect x='125' y='218' width='8' height='6' rx='1'/%3E%3Ccircle cx='128' cy='220.5' r='1'/%3E%3Cpath d='M125 223l2.5-2 2 1.5 1-1 2.5 1.5'/%3E%3Cpath d='M160 223c0-3 2-4.5 4-4.5s4 1.5 4 4.5'/%3E%3Crect x='160' y='222.5' width='2.5' height='3.5' rx='.5'/%3E%3Crect x='165.5' y='222.5' width='2.5' height='3.5' rx='.5'/%3E%3Cpath d='M188 220c1.5-1.5 3.5-1.5 5 0M191 225c-1.5 1.5-3.5 1.5-5 0M188.5 224.5l4.5-4.5'/%3E%3Cpath d='M215 218l-2 4.5h3l-2 4.5'/%3E%3Cpath d='M240 220l-5.5 3 2 1.5 3.5-4.5zM236 224.5l1 3 1.5-2'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 250px 250px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.whatsapp-messages-container::before {
  content: '';
  flex: 1 1 auto;
}

[data-theme="dark"] .whatsapp-messages-container {
  background-color: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Cg fill='none' stroke='%23172a33' stroke-width='0.5' opacity='0.55'%3E%3Cpath d='M12 10h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='42' cy='13' r='4'/%3E%3Cpath d='M42 10v3h2'/%3E%3Crect x='68' y='9' width='5' height='8' rx='1'/%3E%3Ccircle cx='70.5' cy='15' r='.6' fill='%23172a33'/%3E%3Ccircle cx='100' cy='13' r='4'/%3E%3Cpath d='M98 11.5a1 1 0 0 1 2 0M102 11.5a1 1 0 0 1-2 0'/%3E%3Cpath d='M97.5 14.5c1.5 2 3.5 2 5 0'/%3E%3Cpath d='M130 10l1.5 3 3 .5-2 2 .5 3-3-1.5-3 1.5.5-3-2-2 3-.5z'/%3E%3Crect x='155' y='10' width='8' height='6' rx='1'/%3E%3Ccircle cx='159' cy='13' r='1.5'/%3E%3Cpath d='M157 10l1-2h2l1 2'/%3E%3Crect x='185' y='10' width='5' height='4.5' rx='.5'/%3E%3Cpath d='M186 10v-2c0-1.5 3-1.5 3 0v2'/%3E%3Cpath d='M215 8v8'/%3E%3Ccircle cx='214' cy='16' r='1.5'/%3E%3Cpath d='M215 8l3.5-1.5v2l-3.5 1.5'/%3E%3Cpath d='M238 13c0-2 2-3 3-1.5 1-1.5 3-.5 3 1.5s-3 4-3 4-3-2-3-4z'/%3E%3Cpath d='M14 40h4.5c.8 0 1.2.5 1.2 1.2v2.5c0 .8-.4 1.2-1.2 1.2h-1.5l-1.5 1.5v-1.5H14c-.8 0-1.2-.4-1.2-1.2v-2.5c0-.7.4-1.2 1.2-1.2z'/%3E%3Ccircle cx='45' cy='43' r='3.5'/%3E%3Cpath d='M48 46l3 3'/%3E%3Cpath d='M70 38c-3 0-5 3-5 3s2 3 5 3 5-3 5-3-2-3-5-3z'/%3E%3Ccircle cx='70' cy='41' r='1.2'/%3E%3Crect x='95' y='38' width='8' height='6' rx='1'/%3E%3Ccircle cx='98' cy='40.5' r='1'/%3E%3Cpath d='M95 43l2.5-2 2 1.5 1-1 2.5 1.5'/%3E%3Cpath d='M130 43c0-3 2-4.5 4-4.5s4 1.5 4 4.5'/%3E%3Crect x='130' y='42.5' width='2.5' height='3.5' rx='.5'/%3E%3Crect x='135.5' y='42.5' width='2.5' height='3.5' rx='.5'/%3E%3Ccircle cx='162' cy='41' r='4'/%3E%3Cellipse cx='162' cy='41' rx='2' ry='4'/%3E%3Cpath d='M158 41h8'/%3E%3Cpath d='M185 38h5c.3 0 .5.3.5.5v7l-3-2-3 2v-7c0-.2.2-.5.5-.5z'/%3E%3Crect x='213' y='38' width='6' height='6' rx='.5'/%3E%3Cpath d='M213 41h6M215 36v2M217 36v2'/%3E%3Cpath d='M240 36l-2 4.5h3l-2 4.5'/%3E%3Crect x='10' y='68' width='4' height='6' rx='2'/%3E%3Cpath d='M8 73c0 2 2.5 3 4 3s4-1 4-3M12 77v2'/%3E%3Cpath d='M42 68l-5.5 3 2 1.5 3.5-4.5zM38 72.5l1 3 1.5-2'/%3E%3Crect x='65' y='67' width='6' height='8' rx='1'/%3E%3Cpath d='M67 70h2M67 72h2'/%3E%3Ccircle cx='100' cy='71' r='2.5'/%3E%3Cpath d='M103 71h4.5M106 71v2'/%3E%3Cpath d='M130 66a3 3 0 0 0-3 3c0 2.5 3 5 3 5s3-2.5 3-5a3 3 0 0 0-3-3z'/%3E%3Ccircle cx='130' cy='69' r='1' fill='%23172a33'/%3E%3Cpath d='M157 68l4.5 4.5M161.5 72.5c.7.7.3 2-.6 3s-2.2 1.3-3 .6'/%3E%3Cpath d='M188 69c1.5-1.5 3.5-1.5 5 0M191 74c-1.5 1.5-3.5 1.5-5 0M188.5 73.5l4.5-4.5'/%3E%3Cpath d='M215 68h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='242' cy='71' r='4'/%3E%3Cpath d='M242 68v3h2'/%3E%3Cpath d='M12 100h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Crect x='38' y='97' width='5' height='8' rx='1'/%3E%3Ccircle cx='40.5' cy='103' r='.6' fill='%23172a33'/%3E%3Ccircle cx='70' cy='101' r='4'/%3E%3Cpath d='M68 99.5a1 1 0 0 1 2 0M72 99.5a1 1 0 0 1-2 0'/%3E%3Cpath d='M67.5 103c1.5 2 3.5 2 5 0'/%3E%3Cpath d='M100 97l1.5 3 3 .5-2 2 .5 3-3-1.5-3 1.5.5-3-2-2 3-.5z'/%3E%3Crect x='125' y='97' width='8' height='6' rx='1'/%3E%3Ccircle cx='129' cy='100' r='1.5'/%3E%3Cpath d='M127 97l1-2h2l1 2'/%3E%3Crect x='155' y='97' width='5' height='4.5' rx='.5'/%3E%3Cpath d='M156 97v-2c0-1.5 3-1.5 3 0v2'/%3E%3Cpath d='M185 95v8'/%3E%3Ccircle cx='184' cy='103' r='1.5'/%3E%3Cpath d='M185 95l3.5-1.5v2l-3.5 1.5'/%3E%3Cpath d='M210 101c0-2 2-3 3-1.5 1-1.5 3-.5 3 1.5s-3 4-3 4-3-2-3-4z'/%3E%3Ccircle cx='242' cy='101' r='3.5'/%3E%3Cpath d='M245 104l3 3'/%3E%3Cpath d='M14 130h4.5c.8 0 1.2.5 1.2 1.2v2.5c0 .8-.4 1.2-1.2 1.2h-1.5l-1.5 1.5v-1.5H14c-.8 0-1.2-.4-1.2-1.2v-2.5c0-.7.4-1.2 1.2-1.2z'/%3E%3Cpath d='M40 126c-3 0-5 3-5 3s2 3 5 3 5-3 5-3-2-3-5-3z'/%3E%3Ccircle cx='40' cy='129' r='1.2'/%3E%3Crect x='65' y='126' width='8' height='6' rx='1'/%3E%3Ccircle cx='68' cy='128.5' r='1'/%3E%3Cpath d='M65 131l2.5-2 2 1.5 1-1 2.5 1.5'/%3E%3Cpath d='M100 131c0-3 2-4.5 4-4.5s4 1.5 4 4.5'/%3E%3Crect x='100' y='130.5' width='2.5' height='3.5' rx='.5'/%3E%3Crect x='105.5' y='130.5' width='2.5' height='3.5' rx='.5'/%3E%3Ccircle cx='132' cy='129' r='4'/%3E%3Cellipse cx='132' cy='129' rx='2' ry='4'/%3E%3Cpath d='M128 129h8'/%3E%3Cpath d='M155 126h5c.3 0 .5.3.5.5v7l-3-2-3 2v-7c0-.2.2-.5.5-.5z'/%3E%3Crect x='183' y='126' width='6' height='6' rx='.5'/%3E%3Cpath d='M183 129h6M185 124v2M187 124v2'/%3E%3Cpath d='M215 124l-2 4.5h3l-2 4.5'/%3E%3Crect x='237' y='127' width='6' height='8' rx='1'/%3E%3Cpath d='M239 130h2M239 132h2'/%3E%3Crect x='10' y='157' width='4' height='6' rx='2'/%3E%3Cpath d='M8 162c0 2 2.5 3 4 3s4-1 4-3M12 166v2'/%3E%3Cpath d='M42 157l-5.5 3 2 1.5 3.5-4.5zM38 161.5l1 3 1.5-2'/%3E%3Ccircle cx='70' cy='160' r='2.5'/%3E%3Cpath d='M73 160h4.5M76 160v2'/%3E%3Cpath d='M100 155a3 3 0 0 0-3 3c0 2.5 3 5 3 5s3-2.5 3-5a3 3 0 0 0-3-3z'/%3E%3Ccircle cx='100' cy='158' r='1' fill='%23172a33'/%3E%3Cpath d='M127 157l4.5 4.5M131.5 161.5c.7.7.3 2-.6 3s-2.2 1.3-3 .6'/%3E%3Cpath d='M158 158c1.5-1.5 3.5-1.5 5 0M161 163c-1.5 1.5-3.5 1.5-5 0M158.5 162.5l4.5-4.5'/%3E%3Cpath d='M185 157h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='215' cy='160' r='4'/%3E%3Cpath d='M213 158.5a1 1 0 0 1 2 0M217 158.5a1 1 0 0 1-2 0'/%3E%3Cpath d='M212.5 162c1.5 2 3.5 2 5 0'/%3E%3Crect x='238' y='157' width='5' height='8' rx='1'/%3E%3Ccircle cx='240.5' cy='163' r='.6' fill='%23172a33'/%3E%3Cpath d='M12 190h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Cpath d='M42 187l1.5 3 3 .5-2 2 .5 3-3-1.5-3 1.5.5-3-2-2 3-.5z'/%3E%3Crect x='65' y='187' width='8' height='6' rx='1'/%3E%3Ccircle cx='69' cy='190' r='1.5'/%3E%3Cpath d='M67 187l1-2h2l1 2'/%3E%3Crect x='95' y='187' width='5' height='4.5' rx='.5'/%3E%3Cpath d='M96 187v-2c0-1.5 3-1.5 3 0v2'/%3E%3Cpath d='M130 185v8'/%3E%3Ccircle cx='129' cy='193' r='1.5'/%3E%3Cpath d='M130 185l3.5-1.5v2l-3.5 1.5'/%3E%3Cpath d='M155 191c0-2 2-3 3-1.5 1-1.5 3-.5 3 1.5s-3 4-3 4-3-2-3-4z'/%3E%3Ccircle cx='190' cy='191' r='4'/%3E%3Cellipse cx='190' cy='191' rx='2' ry='4'/%3E%3Cpath d='M186 191h8'/%3E%3Cpath d='M213 187h5c.3 0 .5.3.5.5v7l-3-2-3 2v-7c0-.2.2-.5.5-.5z'/%3E%3Crect x='238' y='187' width='6' height='6' rx='.5'/%3E%3Cpath d='M238 190h6M240 185v2M242 185v2'/%3E%3Cpath d='M12 220h5c1 0 1.5.5 1.5 1.5v3c0 1-.5 1.5-1.5 1.5h-2l-1.5 2v-2h-1.5c-1 0-1.5-.5-1.5-1.5v-3c0-1 .5-1.5 1.5-1.5z'/%3E%3Ccircle cx='42' cy='223' r='3.5'/%3E%3Cpath d='M45 226l3 3'/%3E%3Crect x='65' y='218' width='4' height='6' rx='2'/%3E%3Cpath d='M63 223c0 2 2.5 3 4 3s4-1 4-3M67 227v2'/%3E%3Cpath d='M100 218c-3 0-5 3-5 3s2 3 5 3 5-3 5-3-2-3-5-3z'/%3E%3Ccircle cx='100' cy='221' r='1.2'/%3E%3Crect x='125' y='218' width='8' height='6' rx='1'/%3E%3Ccircle cx='128' cy='220.5' r='1'/%3E%3Cpath d='M125 223l2.5-2 2 1.5 1-1 2.5 1.5'/%3E%3Cpath d='M160 223c0-3 2-4.5 4-4.5s4 1.5 4 4.5'/%3E%3Crect x='160' y='222.5' width='2.5' height='3.5' rx='.5'/%3E%3Crect x='165.5' y='222.5' width='2.5' height='3.5' rx='.5'/%3E%3Cpath d='M188 220c1.5-1.5 3.5-1.5 5 0M191 225c-1.5 1.5-3.5 1.5-5 0M188.5 224.5l4.5-4.5'/%3E%3Cpath d='M215 218l-2 4.5h3l-2 4.5'/%3E%3Cpath d='M240 220l-5.5 3 2 1.5 3.5-4.5zM236 224.5l1 3 1.5-2'/%3E%3C/g%3E%3C/svg%3E");
}

/* ===================================
   SEZIONE 3: WHATSAPP INPUT & SEND
   =================================== */

/* â”€â”€ Reply Preview Bar (above input) â”€â”€ */
.wa-reply-preview-bar {
  display: flex;
  align-items: center;
  background: #f0f2f5;
  padding: 6px 10px 0 10px;
  gap: 0;
  position: sticky;
  bottom: 56px;
  z-index: 9998;
  width: 100%;
  box-sizing: border-box;
}
[data-theme="dark"] .wa-reply-preview-bar {
  background: #1f2c34;
}
.wa-reply-preview-content {
  flex: 1;
  display: flex;
  background: #fff;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  min-height: 42px;
  max-height: 70px;
  cursor: pointer;
}
[data-theme="dark"] .wa-reply-preview-content {
  background: #1a2730;
}
.wa-reply-preview-accent {
  width: 4px;
  min-height: 100%;
  background: #00a884;
  border-radius: 4px 0 0 0;
  flex-shrink: 0;
}
.wa-reply-preview-body {
  flex: 1;
  padding: 6px 12px;
  overflow: hidden;
}
.wa-reply-preview-sender {
  font-size: 12.5px;
  font-weight: 600;
  color: #00a884;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-reply-preview-text {
  font-size: 12.5px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
[data-theme="dark"] .wa-reply-preview-text {
  color: #8696a0;
}
.wa-reply-preview-close {
  background: none;
  border: none;
  color: #8696a0;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.wa-reply-preview-close:hover {
  color: #3b4a54;
}
[data-theme="dark"] .wa-reply-preview-close:hover {
  color: #e9edef;
}

.whatsapp-input-bar {
  background: #f0f2f5 !important;
  padding: 5px 10px !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  border-top: none !important;
  box-shadow: none !important;
  flex-shrink: 0 !important;
  min-height: 56px !important;
  height: 56px !important;
  position: sticky !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  width: 100% !important;
  margin: 0 !important;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] .whatsapp-input-bar {
  background: #1f2c34 !important;
  border-top-color: transparent;
  box-shadow: none !important;
}

.whatsapp-input-wrapper {
  flex: 1;
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 14px;
  border: none;
  transition: all 0.2s ease;
  box-shadow: none;
}

.whatsapp-input-wrapper:focus-within {
  border-color: transparent;
  box-shadow: none;
  background: #ffffff;
}

[data-theme="dark"] .whatsapp-input-wrapper {
  background: #2a3942;
  border-color: transparent;
  box-shadow: none;
}

[data-theme="dark"] .whatsapp-input-wrapper:focus-within {
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(0,168,132,0.3);
  background: #2a3942;
}

.whatsapp-input-wrapper input {
  width: 100%;
  border: none;
  background: transparent;
  color: #111b21;
  font-size: 14px;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] .whatsapp-input-wrapper input {
  color: #e9edef;
}

.whatsapp-input-wrapper input::placeholder {
  color: #8696a0;
  font-weight: 400;
}

.whatsapp-send-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  border: none !important;
  background: transparent !important;
  color: #54656f !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.15s ease !important;
  box-shadow: none !important;
  flex-shrink: 0 !important;
  font-size: 18px !important;
}

.whatsapp-send-btn:hover {
  color: #00a884 !important;
  background: transparent !important;
  box-shadow: none;
}

.whatsapp-send-btn:active {
  transform: scale(0.94);
}

.whatsapp-send-btn i {
  transition: transform 0.2s ease;
}

.whatsapp-send-btn:hover .fa-paper-plane {
  transform: translateX(1px) rotate(-5deg);
}

[data-theme="dark"] .whatsapp-send-btn {
  color: #8696a0 !important;
}

[data-theme="dark"] .whatsapp-send-btn:hover {
  color: #00a884 !important;
  background: rgba(0,168,132,0.08) !important;
}

/* Responsive WhatsApp */
@media (max-width: 1200px) {
  .whatsapp-sidebar {
    width: 380px;
  }
}

@media (max-width: 1024px) {
  .whatsapp-sidebar {
    width: 340px;
  }

  .wa-chat-navbar {
    width: 52px;
  }

  .wa-chat-nav-btn {
    width: 42px;
    height: 42px;
  }

  .whatsapp-messages-container {
    padding: 20px 5%;
  }
}

@media (max-width: 768px) {
  .wa-chat-navbar {
    display: none;
  }

  .whatsapp-sidebar {
    width: 100%;
    position: absolute;
    z-index: 10;
    transition: transform 0.3s ease;
    transform: translateX(0);
  }

  .whatsapp-sidebar.hidden {
    display: none;
  }

  .whatsapp-sidebar.slide-out {
    transform: translateX(-100%);
    pointer-events: none;
  }
  
  .whatsapp-messages-container {
    padding: 20px 10px;
  }
}

@media (max-width: 480px) {
  /* Chat sidebar full width */
  .whatsapp-sidebar {
    width: 100%;
  }

  /* Message bubbles wider */
  .wa-message-bubble,
  .message-bubble,
  .whatsapp-message-bubble {
    max-width: 90% !important;
  }

  /* Input bar compact */
  .whatsapp-input-bar,
  .wa-input-area {
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  /* Message text smaller */
  .whatsapp-messages-container {
    padding: 12px 6px;
  }

  /* Attachment/emoji buttons smaller */
  .wa-input-btn,
  .message-action-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 1rem !important;
  }

  /* Chat header compact */
  .whatsapp-chat-header {
    padding: 8px 10px !important;
    min-height: 52px !important;
  }

  .whatsapp-chat-header .chat-name {
    font-size: 14px !important;
  }

  .whatsapp-chat-header .chat-status {
    font-size: 11px !important;
  }
}

/* ===================================
   SEZIONE 4: WAHA COMPONENTS
   =================================== */

:root {
  --waha-green: #25d366;
  --waha-green-dark: #1fa555;
  --waha-green-light: #e8f5e9;
  --waha-gray: #f0f0f0;
  --waha-gray-dark: #8a8a8a;
}

/* Empty State */
.waha-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.waha-empty-icon {
  font-size: 4rem;
  color: var(--waha-green);
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.waha-empty-icon i {
  display: block;
}

.waha-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111;
  margin: 0 0 0.5rem 0;
}

.waha-empty-desc {
  color: #999;
  margin: 0 0 2rem 0;
  font-size: 0.95rem;
}

/* Session Cards */
.waha-session-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.waha-session-card:hover {
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.1);
  border-color: var(--waha-green);
}

.waha-session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.waha-session-info h3 {
  margin: 0 0 0.5rem 0;
  color: #111;
  font-size: 1rem;
}

.waha-session-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.waha-session-status.status-working {
  background: var(--waha-green-light);
  color: var(--waha-green-dark);
}

.waha-session-status.status-scan_qr_code {
  background: #fff3cd;
  color: #856404;
}

.waha-session-status.status-starting {
  background: #cfe2ff;
  color: #084298;
}

.waha-session-status.status-failed {
  background: #f8d7da;
  color: #842029;
}

.waha-session-status.status-stopped {
  background: #e2e3e5;
  color: #383d41;
}

.waha-session-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: var(--waha-gray);
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #ddd;
}

.btn-icon.btn-waha {
  background: var(--waha-green-light);
  color: var(--waha-green-dark);
}

.btn-icon.btn-waha:hover {
  background: var(--waha-green);
  color: white;
}

.btn-waha {
  background: var(--waha-green);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-waha:hover {
  background: var(--waha-green-dark);
  transform: translateY(-2px);
}

.waha-session-details {
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
}

.waha-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.waha-detail-label {
  color: #666;
  font-weight: 500;
}

.waha-detail-value {
  color: #111;
}

/* Modal Overlay */
.waha-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.waha-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: waha-modal-slide-in 0.3s ease;
}

@keyframes waha-modal-slide-in {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.waha-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.waha-modal-header h2 {
  margin: 0;
  color: #111;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.waha-modal-header h2 i {
  color: var(--waha-green);
}

.waha-modal-close {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.waha-modal-close:hover {
  background: var(--waha-gray);
  color: #111;
}

.waha-form {
  padding: 1.5rem;
}

.waha-form-group {
  margin-bottom: 1.5rem;
}

.waha-form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: #111;
  font-weight: 500;
  font-size: 0.95rem;
}

.waha-form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.waha-form-input:focus {
  outline: none;
  border-color: var(--waha-green);
  box-shadow: 0 0 0 3px var(--waha-green-light);
}

.waha-form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.waha-form-actions .btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.waha-form-actions .btn-secondary {
  background: var(--waha-gray);
  color: #111;
}

.waha-form-actions .btn-secondary:hover {
  background: #ddd;
}

/* QR Code Modal */
.waha-qr-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  backdrop-filter: blur(4px);
}

.waha-qr-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  animation: waha-modal-slide-in 0.3s ease;
  overflow: hidden;
}

.waha-qr-modal.waha-modal-fade-out {
  animation: waha-modal-fade-out 0.3s ease forwards;
}

@keyframes waha-modal-fade-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.waha-qr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--waha-green) 0%, var(--waha-green-dark) 100%);
  color: white;
}

.waha-qr-header h2 {
  margin: 0;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.waha-qr-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.waha-qr-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.waha-qr-content {
  padding: 2rem;
}

.waha-qr-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.waha-qr-image {
  padding: 1rem;
  background: white;
  border: 2px solid var(--waha-green);
  border-radius: 12px;
}

.waha-qr-img {
  max-width: 300px;
  height: auto;
  display: block;
}

.waha-qr-loading {
  text-align: center;
  padding: 3rem 1rem;
}

.waha-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 1rem;
  border: 4px solid var(--waha-gray);
  border-top-color: var(--waha-green);
  border-radius: 50%;
  animation: waha-spin 1s linear infinite;
}

@keyframes waha-spin {
  to {
    transform: rotate(360deg);
  }
}

.waha-qr-loading p {
  color: #666;
  font-weight: 500;
}

.waha-qr-instructions {
  background: var(--waha-green-light);
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--waha-green);
}

.waha-qr-instructions p {
  margin: 0 0 1rem 0;
  color: #111;
  font-weight: 600;
  font-size: 0.95rem;
}

.waha-qr-instructions ol {
  margin: 0;
  padding-left: 1.5rem;
  color: #333;
}

.waha-qr-instructions li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.waha-qr-instructions strong {
  color: var(--waha-green-dark);
}

/* ===================================
   SEZIONE 5: WHATSAPP QR MODAL
   =================================== */

.modal-overlay.whatsapp-qr-overlay {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

/* Modal WhatsApp QR */
.modal.whatsapp-qr-modal {
  background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(16, 185, 129, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
  max-width: 580px;
  overflow: hidden;
}

/* Modal Header WhatsApp */
.modal-header.whatsapp-qr-header {
  background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
  color: white;
  padding: 24px 28px;
  border-bottom: none;
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.2);
}

.modal-header.whatsapp-qr-header .modal-title {
  color: white;
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header.whatsapp-qr-header .modal-title i {
  font-size: 22px;
}

.modal-close.whatsapp-qr-close {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  transition: all 0.3s ease;
}

.modal-close.whatsapp-qr-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Modal Body WhatsApp */
.modal-body.whatsapp-qr-body {
  padding: 28px;
  background: #ffffff;
}

/* Status Bar */
.whatsapp-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid #bbf7d0;
}

.whatsapp-status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.whatsapp-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: pulse-green 2s ease-in-out infinite;
}

.whatsapp-status-dot.connected {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.whatsapp-status-dot.disconnected {
  background: #9ca3af;
  animation: none;
}

.whatsapp-status-dot.scanning {
  background: #f59e0b;
  animation: pulse-amber 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
  }
}

@keyframes pulse-amber {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
  }
}

.whatsapp-status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.whatsapp-status-label {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.whatsapp-status-value {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
}

.whatsapp-status-refresh {
  padding: 8px 14px;
  background: white;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #10b981;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.whatsapp-status-refresh:hover {
  background: #f0fdf4;
  transform: rotate(-180deg);
}

/* QR Code Section */
.whatsapp-qr-section {
  background: white;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  border: 2px dashed #e5e7eb;
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.whatsapp-qr-section.hidden {
  display: none;
}

.whatsapp-qr-container {
  margin: 0 auto;
  display: inline-block;
  position: relative;
}

.whatsapp-qr-image {
  width: 260px;
  height: 260px;
  display: block;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(18, 140, 126, 0.15);
  transition: all 0.3s ease;
}

.whatsapp-qr-image:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(18, 140, 126, 0.25);
}

.whatsapp-qr-loading,
.whatsapp-qr-error {
  width: 260px;
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-radius: 12px;
  border: 2px solid #bbf7d0;
}

.whatsapp-qr-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fca5a5;
}

.whatsapp-qr-loading i,
.whatsapp-qr-error i {
  font-size: 32px;
  margin-bottom: 12px;
}

.whatsapp-qr-loading i {
  color: #10b981;
}

.whatsapp-qr-error i {
  color: #ef4444;
}

.whatsapp-qr-loading p,
.whatsapp-qr-error p {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
  text-align: center;
}

/* Instructions Box */
.whatsapp-instructions {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 4px solid #3b82f6;
  margin-top: 16px;
  text-align: left;
}

.whatsapp-instructions-title {
  font-size: 13px;
  color: #1e40af;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.whatsapp-instructions-content {
  font-size: 12px;
  color: #1e40af;
  line-height: 1.6;
  padding-left: 20px;
}

/* Account Info Card */
.whatsapp-account-info {
  display: none;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1.5px solid #6ee7b7;
  animation: slideIn 0.4s ease;
}

.whatsapp-account-info.visible {
  display: flex;
  align-items: center;
  gap: 14px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.whatsapp-account-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 24px;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.whatsapp-account-details {
  flex: 1;
}

.whatsapp-account-name {
  font-weight: 700;
  font-size: 15px;
  color: #065f46;
  margin: 0;
}

.whatsapp-account-phone {
  font-size: 13px;
  color: #10b981;
  margin: 4px 0 0 0;
}

.whatsapp-account-check {
  font-size: 22px;
  color: #10b981;
}

/* Buttons Grid */
.whatsapp-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.whatsapp-btn {
  padding: 14px 16px;
  font-weight: 700;
  border-radius: 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* Primary Green Button */
.whatsapp-btn.primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.whatsapp-btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.whatsapp-btn.primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary Blue Button */
.whatsapp-btn.secondary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.whatsapp-btn.secondary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

.whatsapp-btn.secondary:active:not(:disabled) {
  transform: translateY(0);
}

/* Outline Button */
.whatsapp-btn.outline {
  background: white;
  border: 1.5px solid #e5e7eb;
  color: #6b7280;
  transition: all 0.3s ease;
}

.whatsapp-btn.outline:hover:not(:disabled) {
  border-color: #10b981;
  color: #10b981;
  background: #f0fdf4;
}

/* Danger Button */
.whatsapp-btn.danger {
  background: white;
  border: 1.5px solid #fecaca;
  color: #ef4444;
  transition: all 0.3s ease;
}

.whatsapp-btn.danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #ef4444;
}

/* Disabled State */
.whatsapp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading State */
.whatsapp-btn.loading {
  pointer-events: none;
}

.whatsapp-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Modal Footer */
.modal-footer.whatsapp-qr-footer {
  padding: 16px 28px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.whatsapp-footer-security {
  font-size: 12px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}

.whatsapp-footer-security i {
  color: #10b981;
}

/* Close Button */
.whatsapp-btn.close {
  background: white;
  border: 1.5px solid #e7e7e7;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.whatsapp-btn.close:hover {
  background: #f0f2f5;
  color: #111;
}

.whatsapp-btn.close:active {
  transform: scale(0.95);
}

/* ===================================
   FINE STILI
   =================================== */

/* ===================================
   NUOVE FUNZIONALIT\u00c0 WHATSAPP
   =================================== */

/* Messaggi eliminati */
.message-deleted {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(134, 150, 160, 0.08);
  border-radius: 8px;
  color: #667781;
  font-size: 13px;
  font-style: italic;
}

[data-theme="dark"] .message-deleted {
  background: rgba(134, 150, 160, 0.15);
  color: #8696a0;
}

.message-deleted i {
  opacity: 0.6;
  font-size: 14px;
}

/* Indicatori tipo media migliorati */
.media-type-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #8696a0;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-type-indicator i {
  font-size: 11px;
  color: #00a884;
}

/* Stili contenuti media migliorati */
.message-media-image,
.message-media-video,
.message-media-audio,
.message-media-document {
  position: relative;
  margin-bottom: 8px;
}

.message-media-image img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}

.message-media-image img:hover {
  opacity: 0.95;
}

.message-media-video video {
  max-width: 100%;
  max-height: 360px;
  border-radius: 6px;
  display: block;
  background: #0b141a;
}

/* Voice note styling */
.message-media-audio.voice-note {
  background: rgba(37, 211, 102, 0.08);
  padding: 12px;
  border-radius: 20px;
  border-left: 3px solid #25d366;
}

[data-theme="dark"] .message-media-audio.voice-note {
  background: rgba(37, 211, 102, 0.12);
}

/* Voice note styling */
.message-media-audio.voice-note {
  background: transparent;
  padding: 0;
  border: none;
}

/* WhatsApp-style audio player */
.whatsapp-audio-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border-radius: 8px;
  min-width: 280px;
}

[data-theme="dark"] .whatsapp-audio-player {
  background: transparent;
}

.audio-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #00a884;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-shadow: none;
}

.whatsapp-message.sent .audio-play-btn {
  background: #017561;
}

[data-theme="dark"] .audio-play-btn {
  background: #00a884;
}

.audio-play-btn:hover {
  transform: scale(1.06);
}

.audio-play-btn i {
  font-size: 13px;
  margin-left: 2px;
}

.audio-play-btn .fa-pause {
  margin-left: 0;
}

.audio-waveform {
  flex: 1;
  height: 28px;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.audio-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  border-radius: 4px;
  overflow: hidden;
}

[data-theme="dark"] .audio-progress-bar {
  background: transparent;
}

.audio-progress-fill {
  height: 100%;
  background: rgba(0, 168, 132, 0.15);
  width: 0%;
  transition: width 0.1s linear;
}

.audio-waveform-bars {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 100%;
  padding: 0 2px;
  z-index: 1;
  pointer-events: none;
}

.audio-waveform-bars .bar {
  width: 2.5px;
  background: #8696a0;
  border-radius: 1.5px;
  min-height: 3px;
  opacity: 0.45;
  transition: opacity 0.15s;
}

.whatsapp-message.sent .audio-waveform-bars .bar {
  background: #6b9080;
  opacity: 0.55;
}

[data-theme="dark"] .audio-waveform-bars .bar {
  background: #8696a0;
  opacity: 0.4;
}

.audio-duration {
  font-size: 11px;
  color: #667781;
  font-weight: 400;
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .audio-duration {
  color: #8696a0;
}

/* Hide default audio element */
.whatsapp-audio-player audio {
  display: none;
}

.audio-player-container audio {
  width: 100%;
  height: 36px;
  outline: none;
}

/* PDF e documenti */
.message-media-document.pdf-document {
  background: rgba(231, 76, 60, 0.04);
  border-left: 3px solid #e74c3c;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}

.message-media-document.pdf-document:hover {
  background: rgba(231, 76, 60, 0.06);
}

[data-theme="dark"] .message-media-document.pdf-document {
  background: rgba(231, 76, 60, 0.08);
}

[data-theme="dark"] .message-media-document.pdf-document:hover {
  background: rgba(231, 76, 60, 0.12);
}

.document-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.document-details {
  flex: 1;
  min-width: 0;
}

.document-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-size {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Azioni media (download, preview) */
.media-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}

.media-download-btn,
.media-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: #8696a0;
  text-decoration: none;
  transition: all 0.15s ease;
  font-size: 11px;
  cursor: pointer;
  border: none;
}

.media-download-btn:hover,
.media-preview-btn:hover {
  background: rgba(0, 168, 132, 0.1);
  color: #00a884;
  transform: scale(1.05);
}

[data-theme="dark"] .media-download-btn,
[data-theme="dark"] .media-preview-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #8696a0;
}

[data-theme="dark"] .media-download-btn:hover,
[data-theme="dark"] .media-preview-btn:hover {
  background: rgba(0, 168, 132, 0.15);
  color: #00a884;
}

/* Note indicator in chat flow */
.note-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #f59e0b;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.note-indicator i {
  font-size: 13px;
}

.note-bubble {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  border-left: 3px solid #f59e0b !important;
  color: #78350f !important;
}

[data-theme="dark"] .note-bubble {
  background: linear-gradient(135deg, #451a03 0%, #78350f 100%) !important;
  color: #fef3c7 !important;
}

/* Chat list unread indicators */
.chat-list-item.unread {
  background: #f0fdf4;
  border-left: 3px solid #25d366;
}

[data-theme="dark"] .chat-list-item.unread {
  background: rgba(37, 211, 102, 0.08);
}

.chat-list-item.unread:hover {
  background: #dcfce7;
}

[data-theme="dark"] .chat-list-item.unread:hover {
  background: rgba(37, 211, 102, 0.15);
}

.chat-list-item-avatar.unread-avatar {
  border: 2px solid #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

.chat-list-name.unread-name {
  font-weight: 700;
  color: #111b21;
}

[data-theme="dark"] .chat-list-name.unread-name {
  color: #e9edef;
}

.chat-list-time.unread-time {
  color: #25d366;
  font-weight: 600;
}

.chat-list-item-preview.unread-preview {
  font-weight: 600;
  color: #111b21;
}

[data-theme="dark"] .chat-list-item-preview.unread-preview {
  color: #e9edef;
}

/* Context menu */
.context-menu {
  animation: contextMenuFadeIn 0.15s ease;
}

@keyframes contextMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-theme="dark"] .context-menu-item {
  color: #e9edef;
}

/* Media viewer modal enhancements */
.media-viewer-overlay {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.media-viewer-modal {
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================
   CONTACT INFO PANEL (right side)
   =================================== */

.wa-contact-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  background: #f7f8fa;
  border-left: 1px solid #e9edef;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10020;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wa-contact-info-panel.open {
  width: 340px;
}

[data-theme="dark"] .wa-contact-info-panel {
  background: #0b141a;
  border-left-color: rgba(42, 57, 66, 0.5);
}

.wa-cip-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: #fff;
  color: #111b21;
  min-height: 56px;
  box-sizing: border-box;
  border-bottom: 1px solid #e9edef;
}

[data-theme="dark"] .wa-cip-header {
  background: #1f2c34;
  color: #e9edef;
  border-bottom-color: rgba(233,237,239,0.08);
}

.wa-cip-close {
  background: none;
  border: none;
  color: #54656f;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}

.wa-cip-close:hover {
  background: rgba(11, 20, 26, 0.06);
  color: #111b21;
}

[data-theme="dark"] .wa-cip-close {
  color: #aebac1;
}

[data-theme="dark"] .wa-cip-close:hover {
  background: rgba(255,255,255,0.06);
  color: #e9edef;
}

.wa-cip-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wa-cip-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 92px;
  scrollbar-width: thin;
  scrollbar-color: rgba(134,150,160,0.3) transparent;
}

.wa-cip-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  flex-shrink: 0;
  background: #f7f8fa;
  border-top: 1px solid rgba(233,237,239,0.8);
  padding: 8px 0;
  z-index: 10021;
}

[data-theme="dark"] .wa-cip-footer {
  background: #0b141a;
  border-top-color: rgba(233,237,239,0.08);
}

.wa-cip-body::-webkit-scrollbar {
  width: 4px;
}

.wa-cip-body::-webkit-scrollbar-thumb {
  background: rgba(134,150,160,0.3);
  border-radius: 10px;
}

.wa-cip-body::-webkit-scrollbar-track {
  background: transparent;
}

.wa-cip-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px 24px;
  background: white;
}

[data-theme="dark"] .wa-cip-avatar-section {
  background: #111b21;
}

.wa-cip-avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8ebe4 0%, #dfe5e7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px rgba(11, 20, 26, 0.08);
  transition: transform 0.2s ease;
}

.wa-cip-avatar:hover {
  transform: scale(1.02);
}

[data-theme="dark"] .wa-cip-avatar {
  background: linear-gradient(135deg, #1a252c 0%, #182229 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.wa-cip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-cip-name {
  font-size: 18px;
  font-weight: 600;
  color: #111b21;
  text-align: center;
  margin-bottom: 2px;
  word-break: break-word;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

[data-theme="dark"] .wa-cip-name {
  color: #e9edef;
}

.wa-cip-phone {
  font-size: 13px;
  color: #667781;
  text-align: center;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .wa-cip-phone {
  color: #8696a0;
}

.wa-cip-section {
  background: white;
  padding: 14px 20px;
  margin-top: 8px;
  border-top: 1px solid rgba(233,237,239,0.5);
  border-bottom: 1px solid rgba(233,237,239,0.5);
}

[data-theme="dark"] .wa-cip-section {
  background: #111b21;
  border-top-color: rgba(233,237,239,0.06);
  border-bottom-color: rgba(233,237,239,0.06);
}

.wa-cip-section-label {
  font-size: 12px;
  color: #00a884;
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="dark"] .wa-cip-section-label {
  color: #00a884;
}

.wa-cip-about {
  font-size: 14px;
  color: #111b21;
  line-height: 1.5;
}

[data-theme="dark"] .wa-cip-about {
  color: #e9edef;
}

.wa-cip-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #111b21;
  padding: 6px 0;
  transition: background 0.12s;
  border-radius: 6px;
  margin: -2px -6px;
  padding-left: 6px;
  padding-right: 6px;
}

.wa-cip-detail:hover {
  background: rgba(11, 20, 26, 0.03);
}

[data-theme="dark"] .wa-cip-detail {
  color: #e9edef;
}

[data-theme="dark"] .wa-cip-detail:hover {
  background: rgba(255, 255, 255, 0.04);
}

.wa-cip-detail i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.wa-cip-detail span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-cip-danger {
  margin-top: 0;
  position: static;
  background: #fff;
  border-top-color: rgba(234,67,53,0.08);
}

[data-theme="dark"] .wa-cip-danger {
  background: #111b21;
}

.wa-cip-delete-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 6px;
  margin: -2px -6px;
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-radius: 6px;
  font-weight: 500;
}

.wa-cip-delete-btn:hover {
  background: rgba(231, 76, 60, 0.06);
  color: #c0392b;
}

[data-theme="dark"] .wa-cip-delete-btn:hover {
  background: rgba(231, 76, 60, 0.1);
  color: #ff6b6b;
}

.wa-cip-delete-btn i {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

/* Responsive: su schermi piccoli il pannello copre tutto */
@media (max-width: 768px) {
  .wa-contact-info-panel.open {
    width: 100%;
  }
}

/* ---- Participants list items ---- */
#wa-cip-participants-list {
  max-height: min(38vh, 320px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(134,150,160,0.3) transparent;
}
.wa-cip-participant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(233,237,239,0.7);
  transition: background 0.12s;
  border-radius: 6px;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
}

.wa-cip-participant:last-child {
  border-bottom: none;
}

.wa-cip-participant:hover {
  background: rgba(11, 20, 26, 0.03);
}

[data-theme="dark"] .wa-cip-participant {
  border-bottom-color: rgba(42,57,66,0.6);
}

[data-theme="dark"] .wa-cip-participant:hover {
  background: rgba(255,255,255,0.04);
}

.wa-cip-participant-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  overflow: hidden;
}

.wa-cip-participant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-cip-participant-info {
  flex: 1;
  min-width: 0;
}

.wa-cip-participant-name {
  font-size: 14px;
  font-weight: 500;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

[data-theme="dark"] .wa-cip-participant-name {
  color: #e9edef;
}

.wa-cip-participant-phone {
  font-size: 12px;
  color: #8696a0;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-cip-participant-badge {
  font-size: 10px;
  color: #00a884;
  font-weight: 600;
  padding: 2px 7px;
  border: 1px solid #00a884;
  border-radius: 10px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.wa-cip-participants-empty {
  color: #8696a0;
  font-size: 13px;
  padding: 8px 0;
  text-align: center;
}

.wa-cip-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8696a0;
  font-size: 13px;
  padding: 8px 0;
}

/* Avatar initials in info panel header */
.wa-cip-avatar-initials {
  font-weight: 700;
  font-size: 36px;
  color: #fff;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* ===================================
   CHAT MESSAGE SEARCH BAR
   =================================== */

.wa-chat-search-bar {
  background: #f0f2f5;
  border-bottom: 1px solid #e9edef;
  padding: 6px 12px;
  flex-shrink: 0;
  z-index: 10;
}

[data-theme="dark"] .wa-chat-search-bar {
  background: #202c33;
  border-bottom-color: #2a3942;
}

.wa-chat-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-radius: 8px;
  padding: 4px 10px;
  border: 1px solid #e9edef;
}

[data-theme="dark"] .wa-chat-search-inner {
  background: #2a3942;
  border-color: #3b4a54;
}

.wa-chat-search-icon {
  color: #8696a0;
  font-size: 13px;
  flex-shrink: 0;
}

.wa-chat-search-inner input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #111b21;
  padding: 6px 0;
}

[data-theme="dark"] .wa-chat-search-inner input {
  color: #e9edef;
}

.wa-chat-search-inner input::placeholder {
  color: #8696a0;
}

.wa-chat-search-count {
  font-size: 12px;
  color: #8696a0;
  white-space: nowrap;
  min-width: 40px;
  text-align: center;
}

.wa-chat-search-nav,
.wa-chat-search-close {
  background: none;
  border: none;
  color: #8696a0;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
}

.wa-chat-search-nav:hover,
.wa-chat-search-close:hover {
  color: #00a884;
  background: rgba(0,168,132,0.08);
}

[data-theme="dark"] .wa-chat-search-nav:hover,
[data-theme="dark"] .wa-chat-search-close:hover {
  background: rgba(0,168,132,0.15);
}

/* Search highlights */
.wa-search-highlight {
  background: rgba(255, 220, 0, 0.4);
  border-radius: 2px;
  padding: 0 1px;
}

.wa-search-highlight.active {
  background: rgba(255, 165, 0, 0.7);
  box-shadow: 0 0 0 2px rgba(255,165,0,0.3);
}

[data-theme="dark"] .wa-search-highlight {
  background: rgba(255, 220, 0, 0.25);
}

[data-theme="dark"] .wa-search-highlight.active {
  background: rgba(255, 165, 0, 0.5);
}

/* ===================================
   EMOJI PICKER
   =================================== */

.wa-emoji-picker {
  position: absolute;
  bottom: 50px;
  left: 0;
  width: 340px;
  height: 420px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

[data-theme="dark"] .wa-emoji-picker {
  background: #233138;
  border-color: #374950;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.wa-emoji-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid #e9edef;
  flex-shrink: 0;
}

[data-theme="dark"] .wa-emoji-search-wrap {
  border-bottom-color: #374950;
}

.wa-emoji-search {
  width: 100%;
  border: none;
  background: #f0f2f5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #111b21;
  outline: none;
  box-sizing: border-box;
}

.wa-emoji-search::placeholder {
  color: #8696a0;
}

[data-theme="dark"] .wa-emoji-search {
  background: #2a3942;
  color: #e9edef;
}

.wa-emoji-tabs {
  display: flex;
  border-bottom: 1px solid #e9edef;
  padding: 0 4px;
  flex-shrink: 0;
  overflow-x: auto;
  gap: 0;
}

[data-theme="dark"] .wa-emoji-tabs {
  border-bottom-color: #374950;
}

.wa-emoji-tab {
  flex: 1;
  min-width: 32px;
  padding: 6px 2px;
  font-size: 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  opacity: 0.5;
}

.wa-emoji-tab:hover {
  opacity: 0.8;
  background: rgba(0,0,0,0.04);
}

[data-theme="dark"] .wa-emoji-tab:hover {
  background: rgba(255,255,255,0.06);
}

.wa-emoji-tab.active {
  opacity: 1;
  border-bottom-color: #00a884;
}

.wa-emoji-grid {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px;
}

.wa-emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.wa-emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 3px;
}

[data-theme="dark"] .wa-emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}

.wa-emoji-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s, transform 0.12s;
  user-select: none;
}

.wa-emoji-item:hover {
  background: rgba(0,0,0,0.06);
  transform: scale(1.15);
}

[data-theme="dark"] .wa-emoji-item:hover {
  background: rgba(255,255,255,0.1);
}

/* ===================================
   IMAGE PREVIEW MODAL
   =================================== */

.wa-image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-image-preview-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
}

.wa-image-preview-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  gap: 16px;
}

.wa-image-preview-close {
  position: absolute;
  top: -40px;
  right: -8px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.wa-image-preview-close:hover {
  background: rgba(255,255,255,0.15);
}

.wa-image-preview-img {
  max-width: 70vw;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.wa-image-preview-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.wa-image-preview-add-btn {
  width: 38px;
  height: 38px;
  background: #2a3942;
  border: none;
  border-radius: 50%;
  color: #8696a0;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.wa-image-preview-add-btn:hover {
  background: #374b56;
  color: #e9edef;
}

.wa-image-preview-caption {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: 21px;
  padding: 10px 16px;
  color: #e9edef;
  font-size: 14px;
  outline: none;
}

.wa-image-preview-caption::placeholder {
  color: #8696a0;
}

.wa-image-preview-send {
  width: 46px !important;
  height: 46px !important;
  background: #00a884 !important;
  color: #fff !important;
  border-radius: 50% !important;
  border: none !important;
  font-size: 18px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: background 0.15s !important;
}

.wa-image-preview-send:hover {
  background: #00c49a !important;
}

/* Thumbnail strip for multi-file preview */
.wa-image-preview-strip {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  justify-content: center;
  max-width: 70vw;
  overflow-x: auto;
  padding: 4px 0;
}
.wa-image-preview-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s;
  flex-shrink: 0;
  background: #2a3942;
}
.wa-image-preview-thumb.active {
  border-color: #00a884;
  opacity: 1;
}
.wa-image-preview-thumb-video {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s;
  flex-shrink: 0;
  background: #1b262c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e9edef;
  font-size: 22px;
}
.wa-image-preview-thumb-video.active {
  border-color: #00a884;
  opacity: 1;
}

/* Wrapper per ogni thumb con pulsante X */
.wa-thumb-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.wa-thumb-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 10;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.wa-thumb-wrapper:hover .wa-thumb-remove {
  opacity: 1;
}
.wa-thumb-remove:hover {
  background: #e53e3e;
  border-color: #e53e3e;
}

/* ===================================
   FINE NUOVE FUNZIONALITÃ€
   =================================== */

/* ===================================
   CONTEXT MENU
   =================================== */
@keyframes ctxMenuIn {
  from { opacity: 0; transform: scale(0.92) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.context-menu-item:hover {
  background: #f0f2f5;
}

[data-theme="dark"] .context-menu-item:hover {
  background: #202c33;
}

/* ===================================
   NEW CHAT DIALOG
   =================================== */
.wa-new-chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease-out;
}

.wa-new-chat-dialog {
  background: var(--bg-primary, #fff);
  border-radius: 14px;
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  animation: ctxMenuIn .18s ease-out;
  overflow: hidden;
}

.wa-new-chat-dialog .dialog-header {
  background: #00a884;
  color: #fff;
  padding: 18px 20px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-new-chat-dialog .dialog-header i {
  font-size: 20px;
}

.wa-new-chat-dialog .dialog-body {
  padding: 20px;
}

.wa-new-chat-dialog .dialog-body label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary, #667781);
  margin-bottom: 6px;
  font-weight: 500;
}

.wa-new-chat-dialog .dialog-body input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color, #e0e0e0);
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg-secondary, #f0f2f5);
  color: var(--text-primary, #111b21);
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
}

.wa-new-chat-dialog .dialog-body input:focus {
  border-color: #00a884;
}

.wa-new-chat-dialog .dialog-body .hint {
  font-size: 12px;
  color: var(--text-secondary, #8696a0);
  margin-top: 6px;
}

.wa-new-chat-dialog .dialog-footer {
  padding: 12px 20px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.wa-new-chat-dialog .dialog-footer button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.wa-new-chat-dialog .btn-cancel {
  background: var(--bg-secondary, #f0f2f5);
  color: var(--text-primary, #111b21);
}

.wa-new-chat-dialog .btn-cancel:hover {
  background: var(--border-color, #e0e0e0);
}

.wa-new-chat-dialog .btn-start {
  background: #00a884;
  color: #fff;
}

.wa-new-chat-dialog .btn-start:hover {
  background: #00c49a;
}

.wa-new-chat-dialog .btn-start:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ===================================
   SELECTION MODE
   =================================== */
.selection-mode .chat-list-item {
  display: flex;
  align-items: center;
}

.selection-mode .chat-list-item.selected {
  background: rgba(0, 168, 132, 0.08);
}

[data-theme="dark"] .selection-mode .chat-list-item.selected {
  background: rgba(0, 168, 132, 0.12);
}

/* ===================================
   SHAKE ANIMATION (PIN LOCK)
   =================================== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==============================
   Compose Dialog (New Conversation)
   ============================== */
.wa-compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}

.wa-compose-dialog {
  background: #ffffff;
  border-radius: 18px;
  width: 560px;
  max-width: 96vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  animation: composeSlideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}

[data-theme="dark"] .wa-compose-dialog {
  background: #1a2332;
  box-shadow: 0 25px 70px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
}

@keyframes composeSlideUp {
  from { transform: translateY(24px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}

/* --- Header --- */
.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  background: linear-gradient(135deg, #00a884 0%, #00c49a 100%);
  position: relative;
  overflow: hidden;
}
.compose-header::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

[data-theme="dark"] .compose-header {
  background: linear-gradient(135deg, #0d503f 0%, #0a6b52 100%);
}

.compose-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  letter-spacing: 0.2px;
  z-index: 1;
}

[data-theme="dark"] .compose-header-left {
  color: #e2e8f0;
}

.compose-header-left .fab {
  color: rgba(255,255,255,0.9);
  font-size: 22px;
}

[data-theme="dark"] .compose-header-left .fab {
  color: #5eead4;
}

.compose-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all 0.15s;
  z-index: 1;
  line-height: 1;
}
.compose-close:hover {
  background: rgba(255,255,255,0.25);
  color: #ffffff;
}

[data-theme="dark"] .compose-close {
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
}
[data-theme="dark"] .compose-close:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* --- Body --- */
.compose-body {
  padding: 20px 22px 12px;
  overflow-y: auto;
  flex: 1;
  position: relative;
}

/* Addressbook overlay panel: floats above body content */
.compose-addressbook-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  overflow-y: auto;
  background: #f0f2f5;
  border-radius: 0;
  animation: fadeIn 0.15s ease;
}
[data-theme="dark"] .compose-addressbook-panel {
  background: #0b1520;
}

.compose-field {
  margin-bottom: 18px;
}

.compose-field > label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #667781;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

[data-theme="dark"] .compose-field > label {
  color: #7e8fa0;
}

.compose-field > label i {
  font-size: 11px;
  color: #00a884;
}

/* --- Recipients wrapper --- */
.compose-recipients-wrapper {
  background: #f4f6f8;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  transition: all 0.2s ease;
  min-height: 44px;
}

[data-theme="dark"] .compose-recipients-wrapper {
  background: rgba(255,255,255,0.04);
  border-color: transparent;
}

.compose-recipients-wrapper:focus-within {
  border-color: #00a884;
  background: rgba(0,168,132,0.03);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.08);
}
[data-theme="dark"] .compose-recipients-wrapper:focus-within {
  background: rgba(0,168,132,0.06);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.12);
}

#compose-contact-search {
  background: none;
  border: none;
  color: #111b21;
  font-size: 14px;
  padding: 6px 4px;
  outline: none;
  flex: 1;
  min-width: 120px;
}

[data-theme="dark"] #compose-contact-search {
  color: #e2e8f0;
}

#compose-contact-search::placeholder {
  color: #8696a0;
  font-size: 13px;
}

[data-theme="dark"] #compose-contact-search::placeholder {
  color: #475569;
}

/* --- Chips --- */
.compose-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  background: linear-gradient(135deg, rgba(0,168,132,0.1), rgba(0,168,132,0.06));
  border: 1px solid rgba(0,168,132,0.2);
  border-radius: 20px;
  font-size: 13px;
  color: #00805e;
  animation: chipPop 0.2s cubic-bezier(0.34,1.56,0.64,1);
  backdrop-filter: blur(4px);
}

@keyframes chipPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

[data-theme="dark"] .compose-chip {
  background: rgba(0,168,132,0.15);
  border-color: rgba(0,168,132,0.25);
  color: #5eead4;
}

.chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #00a884;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chip-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.chip-remove {
  cursor: pointer;
  font-size: 10px;
  color: #8696a0;
  transition: all 0.15s;
  padding: 2px;
  border-radius: 50%;
}

.chip-remove:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}

/* --- Contacts dropdown --- */
.compose-contacts-dropdown {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.03);
}

[data-theme="dark"] .compose-contacts-dropdown {
  background: #1a2332;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 10px 32px rgba(0,0,0,0.4);
}

.compose-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.12s ease;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  position: relative;
}

[data-theme="dark"] .compose-contact-item {
  border-bottom-color: rgba(255,255,255,0.03);
}

.compose-contact-item:last-child {
  border-bottom: none;
}

.compose-contact-item:hover {
  background: rgba(0,168,132,0.04);
}
.compose-contact-item:active {
  background: rgba(0,168,132,0.08);
}

[data-theme="dark"] .compose-contact-item:hover {
  background: rgba(255,255,255,0.04);
}

.compose-contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.compose-contact-info {
  flex: 1;
  min-width: 0;
}

.compose-contact-name {
  font-size: 14px;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .compose-contact-name {
  color: #e2e8f0;
}

.compose-contact-detail {
  font-size: 12px;
  color: #8696a0;
  margin-top: 1px;
}

[data-theme="dark"] .compose-contact-detail {
  color: #64748b;
}

.compose-no-results {
  padding: 20px 16px;
  text-align: center;
  color: #8696a0;
  font-size: 13px;
  line-height: 1.5;
}
[data-theme="dark"] .compose-no-results {
  color: #64748b;
}

/* --- Message toolbar --- */
.compose-msg-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.compose-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #f4f6f8;
  border: 1px solid transparent;
  border-radius: 20px;
  color: #667781;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .compose-tool-btn {
  background: rgba(255,255,255,0.05);
  color: #94a3b8;
}

.compose-tool-btn:hover {
  background: rgba(0,168,132,0.08);
  border-color: rgba(0,168,132,0.2);
  color: #00a884;
}

[data-theme="dark"] .compose-tool-btn:hover {
  background: rgba(0,168,132,0.12);
  border-color: rgba(0,168,132,0.25);
  color: #5eead4;
}

.compose-tool-btn i {
  font-size: 12px;
}

/* Address book btn inline */
.compose-ab-btn {
  margin-top: 8px;
}

/* --- Spam warning --- */
.compose-spam-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(234,179,8,0.08);
  border: 1px solid rgba(234,179,8,0.25);
  border-radius: 10px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}
[data-theme="dark"] .compose-spam-warning {
  background: rgba(234,179,8,0.07);
  border-color: rgba(234,179,8,0.2);
  color: #fbbf24;
}
.compose-spam-warning i {
  color: #d97706;
  flex-shrink: 0;
  margin-top: 1px;
}
[data-theme="dark"] .compose-spam-warning i {
  color: #fbbf24;
}

/* --- Textarea --- */
#compose-message {
  width: 100%;
  background: #f4f6f8;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  color: #111b21;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 110px;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  line-height: 1.5;
}

[data-theme="dark"] #compose-message {
  background: rgba(255,255,255,0.04);
  color: #e2e8f0;
}

#compose-message:focus {
  border-color: #00a884;
  background: rgba(0,168,132,0.03);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.08);
}
[data-theme="dark"] #compose-message:focus {
  background: rgba(0,168,132,0.06);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.12);
}

#compose-message::placeholder {
  color: #8696a0;
}

[data-theme="dark"] #compose-message::placeholder {
  color: #475569;
}

/* --- Template panel --- */
.compose-template-panel {
  background: #f8fffe;
  border: 1px solid rgba(0,168,132,0.12);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  animation: fadeIn 0.15s ease;
}

[data-theme="dark"] .compose-template-panel {
  background: rgba(0,168,132,0.04);
  border-color: rgba(0,168,132,0.12);
}

.compose-template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #4a5568;
  font-size: 13px;
  font-weight: 700;
}

[data-theme="dark"] .compose-template-header {
  color: #94a3b8;
}

.compose-template-header > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compose-template-header > span i {
  color: #00a884;
}

.compose-template-new {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: #00a884;
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,168,132,0.25);
}

[data-theme="dark"] .compose-template-new {
  background: #0d9b6e;
  box-shadow: 0 2px 8px rgba(0,168,132,0.2);
}

.compose-template-new:hover {
  background: #00c49a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,168,132,0.3);
}

.compose-template-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compose-template-item {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  transition: all 0.12s;
  cursor: default;
}

[data-theme="dark"] .compose-template-item {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.06);
}

.compose-template-item:hover {
  border-color: rgba(0,168,132,0.2);
  box-shadow: 0 2px 8px rgba(0,168,132,0.06);
}

[data-theme="dark"] .compose-template-item:hover {
  border-color: rgba(0,168,132,0.25);
  background: rgba(255,255,255,0.06);
}

.compose-template-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.template-name {
  font-size: 13px;
  font-weight: 700;
  color: #111b21;
}

[data-theme="dark"] .template-name {
  color: #e2e8f0;
}

.template-category {
  font-size: 10px;
  color: #fff;
  background: #00a884;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
[data-theme="dark"] .template-category {
  background: rgba(0,168,132,0.6);
}

.compose-template-body {
  font-size: 12px;
  color: #667781;
  line-height: 1.5;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  border-left: 3px solid rgba(0,168,132,0.3);
}

[data-theme="dark"] .compose-template-body {
  color: #94a3b8;
  background: rgba(255,255,255,0.02);
  border-left-color: rgba(0,168,132,0.4);
}

.compose-template-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.compose-template-actions button {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.template-use {
  background: #00a884;
  color: #fff;
}
.template-use:hover {
  background: #00c49a;
}
[data-theme="dark"] .template-use {
  background: #0d9b6e;
  color: #fff;
}
[data-theme="dark"] .template-use:hover {
  background: #11b584;
}

.template-delete {
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}
.template-delete:hover {
  background: rgba(239,68,68,0.16);
}
[data-theme="dark"] .template-delete {
  background: rgba(239,68,68,0.12);
}
[data-theme="dark"] .template-delete:hover {
  background: rgba(239,68,68,0.25);
}

/* --- Email template variant (purple scheme) --- */
.email-template-variant {
  background: #faf5ff;
  border-color: rgba(124,58,237,0.12);
}
[data-theme="dark"] .email-template-variant {
  background: rgba(124,58,237,0.04);
  border-color: rgba(124,58,237,0.12);
}
.email-template-variant .compose-template-header > span i {
  color: #7c3aed;
}
.email-template-variant .compose-template-new {
  background: #7c3aed;
  box-shadow: 0 2px 8px rgba(124,58,237,0.25);
}
[data-theme="dark"] .email-template-variant .compose-template-new {
  background: #6d28d9;
  box-shadow: 0 2px 8px rgba(124,58,237,0.2);
}
.email-template-variant .compose-template-new:hover {
  background: #8b5cf6;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
.email-template-variant .compose-template-item:hover {
  border-color: rgba(124,58,237,0.2);
  box-shadow: 0 2px 8px rgba(124,58,237,0.06);
}
[data-theme="dark"] .email-template-variant .compose-template-item:hover {
  border-color: rgba(124,58,237,0.25);
}
.email-template-variant .compose-template-body {
  border-left-color: rgba(124,58,237,0.3);
}
[data-theme="dark"] .email-template-variant .compose-template-body {
  border-left-color: rgba(124,58,237,0.4);
}
.email-template-variant .template-use {
  background: #7c3aed;
}
.email-template-variant .template-use:hover {
  background: #8b5cf6;
}
[data-theme="dark"] .email-template-variant .template-use {
  background: #6d28d9;
}
[data-theme="dark"] .email-template-variant .template-use:hover {
  background: #7c3aed;
}

/* --- Template popup overlay (centered modal) --- */
.template-popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
[data-theme="dark"] .template-popup-overlay {
  background: rgba(0,0,0,0.65);
}
.template-popup-dialog {
  background: #fff;
  border-radius: 16px;
  width: 460px;
  max-width: 92vw;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  overflow: hidden;
  animation: scaleIn 0.18s ease;
}
[data-theme="dark"] .template-popup-dialog {
  background: #1e293b;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.template-popup-dialog .compose-template-panel {
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.template-popup-dialog .compose-template-header {
  padding: 16px 20px;
  margin: 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 14px;
}
[data-theme="dark"] .template-popup-dialog .compose-template-header {
  border-bottom-color: rgba(255,255,255,0.08);
}
.template-popup-dialog .compose-template-list {
  padding: 12px 16px;
  max-height: none;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.template-popup-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}
.template-popup-close:hover {
  background: rgba(0,0,0,0.06);
  color: #374151;
}
[data-theme="dark"] .template-popup-close:hover {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
}

/* --- Schedule panel --- */
.compose-schedule-panel {
  background: #f0f4ff;
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  animation: fadeIn 0.15s ease;
}

[data-theme="dark"] .compose-schedule-panel {
  background: rgba(59,130,246,0.06);
  border-color: rgba(59,130,246,0.15);
}

.compose-schedule-panel label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 10px;
}

.compose-schedule-panel label i {
  color: #3b82f6;
}

#compose-schedule-datetime {
  width: 100%;
  background: #ffffff;
  border: 2px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 11px 14px;
  color: #111b21;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s;
}

[data-theme="dark"] #compose-schedule-datetime {
  background: rgba(255,255,255,0.04);
  border-color: rgba(59,130,246,0.25);
  color: #e2e8f0;
}

#compose-schedule-datetime:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.compose-schedule-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 6px 12px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 20px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

[data-theme="dark"] .compose-schedule-clear {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.18);
  color: #f87171;
}

.compose-schedule-clear:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.25);
}

/* --- Footer --- */
.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: #f8faf9;
}

[data-theme="dark"] .compose-footer {
  border-top-color: rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15);
}

.compose-footer-info {
  font-size: 12px;
  color: #8696a0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.compose-footer-info i {
  color: #3b82f6;
}

.compose-footer-actions {
  display: flex;
  gap: 10px;
}

.compose-footer .btn-cancel {
  padding: 9px 20px;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #667781;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

[data-theme="dark"] .compose-footer .btn-cancel {
  background: transparent;
  border-color: rgba(255,255,255,0.1);
  color: #94a3b8;
}

.compose-footer .btn-cancel:hover {
  background: #f0f2f5;
  border-color: #b5bec5;
  color: #111b21;
}

[data-theme="dark"] .compose-footer .btn-cancel:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
}

.compose-footer .btn-send {
  padding: 9px 24px;
  background: linear-gradient(135deg, #00a884, #00c49a);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 3px 12px rgba(0,168,132,0.3);
  letter-spacing: 0.2px;
}

.compose-footer .btn-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #00c49a, #00dab0);
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(0,168,132,0.35);
}

.compose-footer .btn-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.compose-footer .btn-send.scheduled {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 3px 12px rgba(59,130,246,0.3);
}

.compose-footer .btn-send.scheduled:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  box-shadow: 0 5px 18px rgba(59,130,246,0.35);
}

.compose-loading {
  padding: 24px;
  text-align: center;
  color: #8696a0;
  font-size: 13px;
}
.compose-loading i {
  color: #00a884;
  margin-right: 6px;
}

/* --- Template create overlay --- */
.wa-template-create-overlay {
  position: fixed;
  inset: 0;
  z-index: 21000;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.12s ease;
}

.wa-template-create-dialog {
  background: #ffffff;
  border-radius: 16px;
  width: 440px;
  max-width: 94vw;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  overflow: hidden;
}

[data-theme="dark"] .wa-template-create-dialog {
  background: #1a2332;
  box-shadow: 0 20px 55px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.06);
}

.wa-template-create-dialog .dialog-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #00a884 0%, #00c49a 100%);
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .wa-template-create-dialog .dialog-header {
  background: linear-gradient(135deg, #0d503f 0%, #0a6b52 100%);
  color: #e2e8f0;
}

.wa-template-create-dialog .dialog-header i {
  color: rgba(255,255,255,0.85);
}
[data-theme="dark"] .wa-template-create-dialog .dialog-header i {
  color: #5eead4;
}

.wa-template-create-dialog .dialog-body {
  padding: 18px 20px;
}

.wa-template-create-dialog label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #667781;
  margin-bottom: 6px;
  margin-top: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .wa-template-create-dialog label {
  color: #7e8fa0;
}

.wa-template-create-dialog label:first-child {
  margin-top: 0;
}

.wa-template-create-dialog input,
.wa-template-create-dialog select,
.wa-template-create-dialog textarea {
  width: 100%;
  background: #f4f6f8;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  color: #111b21;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s;
}

[data-theme="dark"] .wa-template-create-dialog input,
[data-theme="dark"] .wa-template-create-dialog select,
[data-theme="dark"] .wa-template-create-dialog textarea {
  background: rgba(255,255,255,0.04);
  color: #e2e8f0;
}

.wa-template-create-dialog input:focus,
.wa-template-create-dialog select:focus,
.wa-template-create-dialog textarea:focus {
  border-color: #00a884;
  background: rgba(0,168,132,0.03);
  box-shadow: 0 0 0 3px rgba(0,168,132,0.06);
}

.wa-template-create-dialog .hint {
  font-size: 11px;
  color: #8696a0;
  margin-top: 4px;
  line-height: 1.4;
}

[data-theme="dark"] .wa-template-create-dialog .hint {
  color: #64748b;
}

.wa-template-create-dialog .dialog-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8faf9;
}

[data-theme="dark"] .wa-template-create-dialog .dialog-footer {
  border-top-color: rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15);
}

/* Template dialog buttons */
.wa-template-create-dialog .btn-cancel,
.wa-template-create-dialog .btn-start {
  padding: 9px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.wa-template-create-dialog .btn-cancel {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #667781;
}
.wa-template-create-dialog .btn-cancel:hover {
  background: #f0f2f5;
  color: #111b21;
}
[data-theme="dark"] .wa-template-create-dialog .btn-cancel {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
}
[data-theme="dark"] .wa-template-create-dialog .btn-cancel:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.wa-template-create-dialog .btn-start {
  background: linear-gradient(135deg, #00a884, #00c49a);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,168,132,0.25);
}
.wa-template-create-dialog .btn-start:hover {
  background: linear-gradient(135deg, #00c49a, #00dab0);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,168,132,0.3);
}

/* ==============================
   Compose Address Book Picker
   ============================== */

/* Spam warning banner */
.compose-spam-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fef3c7, #fde68a30);
  border: 1px solid rgba(245,158,11,0.35);
  color: #92400e;
  font-size: 12px;
  line-height: 1.5;
  animation: fadeIn 0.2s ease;
}
.compose-spam-warning i {
  color: #f59e0b;
  font-size: 18px;
  margin-top: 1px;
  flex-shrink: 0;
}
.compose-spam-warning strong {
  color: #b45309;
  font-weight: 700;
}
[data-theme="dark"] .compose-spam-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}
[data-theme="dark"] .compose-spam-warning strong {
  color: #fbbf24;
}

/* Address book panel */
.compose-addressbook-panel {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  margin-top: 10px;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
[data-theme="dark"] .compose-addressbook-panel {
  background: #141e2b;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 6px 22px rgba(0,0,0,0.3);
}

.compose-ab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,168,132,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px;
  font-weight: 700;
  color: #111b21;
}
[data-theme="dark"] .compose-ab-header {
  border-bottom-color: rgba(255,255,255,0.06);
  color: #e2e8f0;
  background: rgba(0,168,132,0.06);
}
.compose-ab-header > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.compose-ab-header i {
  color: #00a884;
}
.compose-ab-close {
  background: none;
  border: none;
  color: #8696a0;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compose-ab-close:hover {
  background: rgba(0,0,0,0.06);
  color: #111b21;
}
[data-theme="dark"] .compose-ab-close {
  color: #94a3b8;
}
[data-theme="dark"] .compose-ab-close:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* Tabs */
.compose-ab-tabs {
  display: flex;
  padding: 0 12px;
  background: rgba(0,0,0,0.01);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
[data-theme="dark"] .compose-ab-tabs {
  border-bottom-color: rgba(255,255,255,0.06);
  background: transparent;
}
.compose-ab-tab {
  flex: 1;
  padding: 10px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 700;
  color: #8696a0;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.compose-ab-tab:hover {
  color: #00a884;
  background: rgba(0,168,132,0.03);
}
.compose-ab-tab.active {
  color: #00a884;
  border-bottom-color: #00a884;
}
[data-theme="dark"] .compose-ab-tab {
  color: #64748b;
}
[data-theme="dark"] .compose-ab-tab:hover,
[data-theme="dark"] .compose-ab-tab.active {
  color: #5eead4;
  border-bottom-color: #5eead4;
}

/* Search */
.compose-ab-search {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
[data-theme="dark"] .compose-ab-search {
  border-bottom-color: rgba(255,255,255,0.04);
}
.compose-ab-search input {
  width: 100%;
  background: #f4f6f8;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 9px 14px 9px 36px;
  font-size: 13px;
  color: #111b21;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%238696a0' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 14px;
  background-position: 12px center;
}
.compose-ab-search input:focus {
  border-color: #00a884;
  background-color: rgba(0,168,132,0.03);
}
.compose-ab-search input::placeholder {
  color: #8696a0;
}
[data-theme="dark"] .compose-ab-search input {
  background-color: rgba(255,255,255,0.04);
  border-color: transparent;
  color: #e2e8f0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23475569' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
}
[data-theme="dark"] .compose-ab-search input:focus {
  background-color: rgba(0,168,132,0.06);
}
[data-theme="dark"] .compose-ab-search input::placeholder {
  color: #475569;
}

/* Contacts list */
#compose-ab-contacts {
  max-height: 240px;
  overflow-y: auto;
}

/* Group */
.compose-ab-group {
  margin-bottom: 0;
}
.compose-ab-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,168,132,0.03);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  cursor: default;
}
[data-theme="dark"] .compose-ab-group-header {
  background: rgba(0,168,132,0.04);
  border-bottom-color: rgba(255,255,255,0.04);
}

.compose-ab-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
}
.compose-ab-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #00a884;
  cursor: pointer;
  flex-shrink: 0;
}

.compose-ab-group-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #4a5568;
}
[data-theme="dark"] .compose-ab-group-name {
  color: #94a3b8;
}
.compose-ab-group-name i {
  color: #00a884;
  font-size: 13px;
}
.compose-ab-group-count {
  background: rgba(0,168,132,0.1);
  color: #00a884;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}
[data-theme="dark"] .compose-ab-group-count {
  background: rgba(0,168,132,0.15);
  color: #5eead4;
}

/* Items inside group */
.compose-ab-items {
  padding: 0;
}

/* Individual item */
.compose-ab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 40px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(0,0,0,0.025);
}
[data-theme="dark"] .compose-ab-item {
  border-bottom-color: rgba(255,255,255,0.025);
}
.compose-ab-item:last-child {
  border-bottom: none;
}
.compose-ab-item:hover {
  background: rgba(0,168,132,0.03);
}
[data-theme="dark"] .compose-ab-item:hover {
  background: rgba(0,168,132,0.05);
}

.compose-ab-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #00a884;
  cursor: pointer;
  flex-shrink: 0;
}

.compose-ab-item-info {
  flex: 1;
  min-width: 0;
}
.compose-ab-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .compose-ab-item-name {
  color: #e2e8f0;
}
.compose-ab-item-phone {
  font-size: 11px;
  color: #8696a0;
  margin-top: 1px;
}
[data-theme="dark"] .compose-ab-item-phone {
  color: #64748b;
}

/* Footer */
.compose-ab-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: #f8faf9;
}
[data-theme="dark"] .compose-ab-footer {
  border-top-color: rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.15);
}

.compose-ab-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #00a884, #00c49a);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,168,132,0.25);
}
.compose-ab-confirm:hover {
  background: linear-gradient(135deg, #00c49a, #00dab0);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,168,132,0.3);
}

/* Responsive */
@media (max-width: 600px) {
  .wa-compose-dialog {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .compose-header { border-radius: 0; }
  .compose-footer { border-radius: 0; }
}

/* Disabled address book items (no phone number) */
.compose-ab-item-disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
}
.compose-ab-item-disabled .compose-contact-avatar {
  filter: grayscale(1);
}
.compose-ab-no-phone {
  color: #ef4444 !important;
  font-size: 10px !important;
  display: flex;
  align-items: center;
  gap: 4px;
}
.compose-ab-no-phone i {
  font-size: 10px;
}
[data-theme="dark"] .compose-ab-no-phone {
  color: #f87171 !important;
}

/* Compose chips container */
.compose-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Send button inner span */
.compose-footer .btn-send span {
  white-space: nowrap;
}

/* â”€â”€â”€ Assign Conversation Dropdown â”€â”€â”€ */
.wa-assign-dropdown {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  width: 280px;
  max-height: 400px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  animation: waAssignFadeIn .15s ease;
}
@keyframes waAssignFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wa-assign-dd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e9edef;
  font-size: 0.9rem;
  font-weight: 600;
  color: #111b21;
}
.wa-assign-dd-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #8696a0;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
}
.wa-assign-dd-close:hover {
  color: #111b21;
  background: #f0f2f5;
}
.wa-assign-dd-body {
  overflow-y: auto;
  flex: 1;
  max-height: 340px;
}
.wa-assign-dd-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f0fdf4;
  border-bottom: 1px solid #e9edef;
  font-size: 0.82rem;
  color: #111b21;
}
.wa-assign-dd-unassign {
  background: none;
  border: none;
  cursor: pointer;
  color: #8696a0;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}
.wa-assign-dd-unassign:hover {
  color: #dc2626;
  background: #fef2f2;
}
.wa-assign-dd-section-title {
  padding: 8px 16px 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8696a0;
  font-weight: 600;
}
.wa-assign-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #111b21;
  transition: background .12s;
}
.wa-assign-dd-item:hover {
  background: #f0f2f5;
}
.wa-assign-dd-item .fa-check {
  font-size: 0.75rem;
}

/* ============================================================
   WHATSAPP MAIN AREA â€” New class-based styles
   ============================================================ */

/* Empty state content — see whatsapp.css .whatsapp-empty-icon, .whatsapp-empty-title */

/* Back button in header */
.wa-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px 6px 0;
  color: var(--text-primary, #111b21);
  font-size: 18px;
  line-height: 1;
}
[data-theme="dark"] .wa-back-btn { color: #e9edef; }

/* Header badge buttons */
.wa-hdr-badge-btn { position: relative; }

.wa-hdr-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: #fff;
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}
.wa-hdr-badge--amber { background: #f59e0b; }
.wa-hdr-badge--green { background: #25d366; }

.wa-hdr-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #25d366;
  border-radius: 50%;
  border: 2px solid var(--wa-header-bg, #fff);
  pointer-events: none;
}
[data-theme="dark"] .wa-hdr-dot { border-color: #1f2c34; }

/* Image preview counter pill */
.wa-image-preview-counter {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  border-radius: 12px;
  padding: 2px 12px;
  font-size: 13px;
  z-index: 2;
  white-space: nowrap;
}

/* Image preview video */
.wa-image-preview-video {
  max-width: 100%;
  max-height: 60vh;
}

/* Enter-chat overlay */
.wa-enter-chat-overlay {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary, #f0f2f5);
  border-radius: inherit;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
[data-theme="dark"] .wa-enter-chat-overlay { background: #1f2c34; }

.wa-enter-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #128c7e, #25d366);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 8px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(18,140,126,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wa-enter-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(18,140,126,0.35);
}

/* Input normal elements wrapper */
.wa-input-elements {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.wa-input-action-wrap { position: relative; }

/* Plus menu */
.wa-plus-menu {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  padding: 16px 12px;
  z-index: 1000;
  min-width: 220px;
  animation: waMenuSlideUp 0.2s ease;
}
[data-theme="dark"] .wa-plus-menu {
  background: #233138;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45);
}
.wa-plus-menu-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.wa-plus-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  width: 72px;
  border-radius: 10px;
  padding: 6px 4px;
  transition: background 0.15s ease;
}
.wa-plus-menu-item:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .wa-plus-menu-item:hover { background: rgba(255,255,255,0.06); }
.wa-plus-menu-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wa-plus-menu-icon i {
  color: #fff;
  font-size: 18px;
}
.wa-plus-menu-item span {
  font-size: 11px;
  color: #667781;
  text-align: center;
}
[data-theme="dark"] .wa-plus-menu-item span { color: #8696a0; }

/* Toolbar accent buttons (template, schedule) */
.wa-toolbar-btn--purple { color: #7c3aed !important; }
.wa-toolbar-btn--teal   { color: #128c7e !important; }

/* ---- Folder search results in chat list ---- */
.folder-search-section {
  padding: 4px 8px 2px;
}
.folder-search-header {
  font-size: 0.7rem;
  font-weight: 600;
  color: #8696a0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 4px 4px;
}
.folder-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.folder-search-item:hover { background: var(--hover-bg, #f0f2f5); }
.folder-search-item.active { background: #e7f8ee; }
.folder-search-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.folder-search-item-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary, #111b21);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-search-item-count {
  font-size: 0.72rem;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 8px;
  padding: 1px 7px;
  flex-shrink: 0;
}
[data-theme="dark"] .folder-search-item:hover { background: #2a3942; }
[data-theme="dark"] .folder-search-item.active { background: #1a3329; }
[data-theme="dark"] .folder-search-item-name { color: #e9edef; }
[data-theme="dark"] .folder-search-item-count { background: #374151; color: #9ca3af; }
[data-theme="dark"] .folder-search-header { color: #657983; }
