/* =========================================================
   WHATSAPP FAKE - AUTHENTIC STYLESHEET
   EditFun Suite - Pixel Perfect WhatsApp Web & Mobile
   ========================================================= */

:root {
  --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  /* Brand */
  --wa-green: #25d366;
  --wa-green-deep: #00a884;
  --wa-green-hover: #06cf9c;
  --wa-blue-tick: #53bdeb;
  --wa-red-hangup: #ea0038;
  
  /* Tema Oscuro (Por defecto) */
  --bg-app: #0c1317;
  --bg-sidebar: #111b21;
  --bg-sidebar-header: #202c33;
  --bg-chat-header: #202c33;
  --bg-chat-area: #0b141a;
  --bg-input-bar: #202c33;
  --bg-search: #202c33;
  --bg-hover: #202c33;
  --bg-active: #2a3942;
  --bg-filter-pill: #202c33;
  --bg-filter-pill-active: #00a884;
  --text-filter-pill-active: #111b21;
  
  --dropdown-bg: #233138;
  --dropdown-hover: #182229;
  --modal-bg: #222e35;
  --modal-header-bg: #1f2c34;
  
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --text-green: #00a884;
  --text-link: #53bdeb;
  
  --border-color: #222d34;
  --border-subtle: #202c33;
  
  --bubble-sent: #005c4b;
  --bubble-sent-text: #e9edef;
  --bubble-received: #202c33;
  --bubble-received-text: #e9edef;
  --bubble-timestamp: rgba(233, 237, 239, 0.6);
  --bubble-system-bg: #182229;
  --bubble-system-text: #ffd279;
  
  --audio-bar-played: #00a884;
  --audio-bar-unplayed: #8696a0;
  
  --avatar-bg-default: #374248;
  --avatar-text-default: #cfd4d8;
  
  --status-bar-bg: #111b21;
  --mobile-nav-bg: #111b21;
}

/* Tema Claro */
body.theme-light {
  --bg-app: #d1d7db;
  --bg-sidebar: #ffffff;
  --bg-sidebar-header: #f0f2f5;
  --bg-chat-header: #f0f2f5;
  --bg-chat-area: #efeae2;
  --bg-input-bar: #f0f2f5;
  --bg-search: #f0f2f5;
  --bg-hover: #f5f6f6;
  --bg-active: #e9edef;
  --bg-filter-pill: #f0f2f5;
  --bg-filter-pill-active: #e7fce3;
  --text-filter-pill-active: #008069;
  
  --dropdown-bg: #ffffff;
  --dropdown-hover: #f5f6f6;
  --modal-bg: #ffffff;
  --modal-header-bg: #f0f2f5;
  
  --text-primary: #111b21;
  --text-secondary: #667781;
  --text-muted: #8696a0;
  --text-green: #008069;
  --text-link: #027eb5;
  
  --border-color: #e9edef;
  --border-subtle: #f0f2f5;
  
  --bubble-sent: #d9fdd3;
  --bubble-sent-text: #111b21;
  --bubble-received: #ffffff;
  --bubble-received-text: #111b21;
  --bubble-timestamp: rgba(17, 27, 33, 0.6);
  --bubble-system-bg: #ffeecd;
  --bubble-system-text: #54656f;
  
  --audio-bar-played: #008069;
  --audio-bar-unplayed: #b2b8bd;
  
  --avatar-bg-default: #dfe5e7;
  --avatar-text-default: #54656f;
  
  --status-bar-bg: #f0f2f5;
  --mobile-nav-bg: #ffffff;
}

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  user-select: none;
}

/* =========================================================
   APP VIEWPORT & DISPOSITIVO
   ========================================================= */
.app-viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: var(--visual-viewport-height, 100dvh);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-app);
}

.mobile-frame-container {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: var(--visual-viewport-height, 100dvh);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Modo Automático (Escritorio > 768px, Móvil <= 768px) */
@media (min-width: 769px) {
  body.mode-auto .mobile-status-bar,
  body.mode-auto .wa-mobile-nav,
  body.mode-auto .mobile-only-icon,
  body.mode-auto .wa-fab-btn,
  body.mode-auto .mobile-header-title,
  body.mode-auto .wa-back-btn {
    display: none !important;
  }

  body.mode-auto .desktop-header-title,
  body.mode-auto .desktop-only-icon {
    display: block !important;
  }
}

@media (max-width: 768px) {
  body.mode-auto .desktop-header-title,
  body.mode-auto .desktop-only-icon,
  body.mode-auto .sidebar-resizer {
    display: none !important;
  }

  body.mode-auto .mobile-status-bar {
    display: flex !important;
  }

  body.mode-auto .mobile-header-title {
    display: block !important;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-green);
  }

  body.mode-auto .wa-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body.mode-auto .wa-app-layout.mobile-in-chat .wa-sidebar {
    display: none !important;
  }

  body.mode-auto .wa-app-layout.mobile-in-chat .wa-chat-area {
    display: flex !important;
  }

  body.mode-auto .wa-app-layout.mobile-in-list .wa-sidebar {
    display: flex !important;
  }

  body.mode-auto .wa-app-layout.mobile-in-list .wa-chat-area {
    display: none !important;
  }
}

/* Modo Forzado Móvil (Marco Smartphone en Desktop) */
body.mode-forced-mobile .mobile-frame-container {
  width: 412px;
  height: 870px;
  max-height: 94vh;
  border-radius: 36px;
  border: 8px solid #1f2c34;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  background: var(--bg-sidebar);
}

body.mode-forced-mobile .desktop-header-title,
body.mode-forced-mobile .desktop-only-icon,
body.mode-forced-mobile .sidebar-resizer {
  display: none !important;
}

body.mode-forced-mobile .mobile-status-bar {
  display: flex !important;
}

body.mode-forced-mobile .mobile-header-title {
  display: block !important;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-green);
}

body.mode-forced-mobile .wa-sidebar {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

body.mode-forced-mobile .wa-app-layout.mobile-in-chat .wa-sidebar {
  display: none !important;
}

body.mode-forced-mobile .wa-app-layout.mobile-in-chat .wa-chat-area {
  display: flex !important;
}

body.mode-forced-mobile .wa-app-layout.mobile-in-list .wa-sidebar {
  display: flex !important;
}

body.mode-forced-mobile .wa-app-layout.mobile-in-list .wa-chat-area {
  display: none !important;
}

/* Barra de Estado Móvil */
.mobile-status-bar {
  height: 32px;
  padding: 0 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  background-color: var(--status-bar-bg);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  z-index: 10;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-5g {
  font-size: 11px;
  font-weight: 700;
}

.status-battery {
  display: flex;
  align-items: center;
  gap: 4px;
}

.battery-icon-pill {
  width: 20px;
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 1px;
  display: flex;
  align-items: center;
  position: relative;
}

.battery-icon-pill::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}

.battery-fill {
  height: 100%;
  background: currentColor;
  border-radius: 1px;
}

/* =========================================================
   LAYOUT PRINCIPAL
   ========================================================= */
.wa-app-layout {
  width: 100%;
  height: 100%;
  display: flex;
  position: relative;
  background-color: var(--bg-app);
  overflow: hidden;
  flex: 1;
}

/* SIDEBAR (LISTA DE CHATS) */
.wa-sidebar {
  width: 380px;
  min-width: 280px;
  max-width: 600px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-sidebar);
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}

/* Deslizador de Ancho (Resizer) */
.sidebar-resizer {
  width: 4px;
  height: 100%;
  background-color: var(--border-color);
  cursor: col-resize;
  transition: background-color 0.15s ease;
  z-index: 10;
  flex-shrink: 0;
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
  background-color: var(--wa-green-deep);
  width: 6px;
}

/* Header Lateral */
.wa-sidebar-header {
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-sidebar-header);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.wa-brand-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-app-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.wa-app-logo-badge svg {
  display: block;
}

.wa-app-logo-badge:hover {
  transform: scale(1.08);
}

.desktop-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.wa-sidebar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wa-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
  position: relative;
}

.wa-icon-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.wa-back-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 4px;
}

/* Barra de Búsqueda Redonda */
.wa-search-container {
  padding: 8px 12px;
  background-color: var(--bg-sidebar);
  flex-shrink: 0;
}

.wa-search-input-wrap {
  display: flex;
  align-items: center;
  background-color: var(--bg-search);
  border-radius: 18px;
  padding: 4px 12px;
  height: 36px;
}

.wa-search-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 10px;
  cursor: pointer;
}

.wa-search-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-primary);
}

.wa-search-field::placeholder {
  color: var(--text-secondary);
}

/* Filtro Pastillas */
.wa-filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.wa-filter-pills::-webkit-scrollbar {
  display: none;
}

.wa-pill {
  padding: 6px 14px;
  background-color: var(--bg-filter-pill);
  color: var(--text-secondary);
  border: none;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.wa-pill:hover {
  color: var(--text-primary);
}

.wa-pill.active {
  background-color: var(--bg-filter-pill-active);
  color: var(--text-filter-pill-active);
  font-weight: 600;
}

/* Lista Dinámica de Chats */
.wa-chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.wa-chat-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  user-select: none;
  touch-action: pan-y;
}

.wa-chat-item:hover {
  background-color: var(--bg-hover);
}

.wa-chat-item.active {
  background-color: var(--bg-active);
}

/* Reordenación de Chats con Flechas */
.wa-reorder-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  animation: fadeInMenu 0.15s ease;
}

.btn-reorder-done {
  background: var(--wa-green-deep);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reorder-done:hover {
  background: var(--wa-green-hover);
}

.wa-chat-item.in-reorder-mode {
  transition: background-color 0.15s ease;
}

.wa-chat-reorder-arrows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  flex-shrink: 0;
  z-index: 5;
}

.wa-reorder-btn {
  width: 28px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.wa-reorder-btn.single-arrow {
  height: 28px;
  border-radius: 6px;
}

.wa-reorder-btn:hover {
  background: var(--wa-green-deep);
  color: #ffffff;
  border-color: var(--wa-green-deep);
  transform: scale(1.06);
}

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

.wa-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  background: var(--avatar-bg-default);
  color: var(--avatar-text-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  margin-right: 14px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.wa-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.wa-chat-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wa-chat-info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wa-chat-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat-time-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.wa-chat-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.wa-chat-time.unread {
  color: var(--wa-green-deep);
  font-weight: 600;
}

/* Icono Chincheta / Pin */
.wa-chat-pin-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  transform: rotate(45deg);
}

.wa-chat-info-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wa-chat-snippet {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.wa-chat-snippet.typing-text {
  color: var(--wa-green);
  font-weight: 500;
}

.wa-chat-badge {
  background-color: var(--wa-green);
  color: #111b21;
  font-size: 11.5px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: 6px;
  flex-shrink: 0;
}

/* FAB Nuevo Chat Móvil */
.wa-fab-btn {
  position: absolute;
  bottom: 68px;
  right: 18px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background-color: var(--wa-green);
  color: #111b21;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 15;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wa-fab-btn:hover {
  transform: scale(1.08);
}

/* Barra de Navegación Inferior (Móvil) */
.wa-mobile-nav {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background-color: var(--mobile-nav-bg);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mobile-nav-tab {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.mobile-nav-tab.active {
  color: var(--text-primary);
  font-weight: 600;
}

.nav-icon-wrap {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: -3px;
  right: -7px;
  background-color: var(--wa-green);
  color: #111b21;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 4px;
}

.nav-dot {
  position: absolute;
  top: 1px;
  right: -2px;
  width: 6px;
  height: 6px;
  background-color: var(--wa-green);
  border-radius: 50%;
}

/* =========================================================
   CHAT AREA (PANEL DERECHO)
   ========================================================= */
.wa-chat-area {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-chat-area);
  position: relative;
  overflow: hidden;
}

.wa-no-chat-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-chat-header);
  border-bottom: 6px solid var(--wa-green-deep);
}

.no-chat-content {
  text-align: center;
  max-width: 460px;
  padding: 20px;
}

.wa-lock-icon-circle {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.no-chat-content h2 {
  font-size: 30px;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.no-chat-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
}

.end-to-end-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Wrapper Activo */
.wa-active-chat-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header del Chat Activo */
.wa-chat-header {
  height: 60px;
  padding: 0 12px 0 8px;
  display: flex;
  align-items: center;
  background-color: var(--bg-chat-header);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 5;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.wa-contact-info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  overflow: hidden;
  transition: background-color 0.15s ease;
}

.wa-contact-info-header:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.wa-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  background: var(--avatar-bg-default);
  color: var(--avatar-text-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.wa-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.wa-header-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.wa-header-name-row {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.wa-header-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

.wa-header-status {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}

.wa-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

/* =========================================================
   MENSAJES & COLOR PLANO LIMPIO
   ========================================================= */
.wa-messages-viewport {
  flex: 1;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--bg-chat-area);
}

.wa-messages-container {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .wa-messages-container {
    padding: 12px 10px;
  }
}

body.mode-forced-mobile .wa-messages-container {
  padding: 12px 10px;
}

/* Divisores de Fecha & Aviso Cifrado (Separadores Interactivos y Eliminables) */
.wa-separator-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 6px 0;
  position: relative;
  transition: background-color 0.15s ease;
}

.wa-separator-row.selected {
  background-color: rgba(0, 168, 132, 0.08);
}

.wa-separator-row.selection-mode .msg-select-checkbox-wrap {
  display: flex;
}

.wa-separator-row.selected .msg-select-checkbox {
  background-color: var(--wa-green-deep);
  border-color: var(--wa-green-deep);
}

.wa-separator-row.selected .msg-select-checkbox::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.wa-date-divider-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bubble-received);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

.wa-date-divider-pill:hover {
  background-color: var(--bg-hover);
}

.wa-encryption-notice-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 520px;
  background-color: var(--bubble-system-bg);
  color: var(--bubble-system-text);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 8px 16px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  user-select: none;
  transition: filter 0.15s ease;
}

.wa-encryption-notice-box:hover {
  filter: brightness(1.06);
}

.wa-encryption-notice-box svg {
  flex-shrink: 0;
  color: #ffd279;
}

.wa-separator-chevron-btn {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  margin-left: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.wa-date-divider-pill:hover .wa-separator-chevron-btn,
.wa-encryption-notice-box:hover .wa-separator-chevron-btn {
  display: inline-flex;
}

.wa-separator-chevron-btn:hover {
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
}

/* =========================================================
   BARRA SUPERIOR DE SELECCIÓN DE MENSAJES
   ========================================================= */
.wa-selection-topbar {
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-chat-header);
  border-bottom: 1px solid var(--border-subtle);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  animation: slideDownBar 0.15s ease;
}

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

.selection-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* =========================================================
   BURBUJAS DE MENSAJES (MESSAGE BUBBLES)
   ========================================================= */
.wa-msg-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 2px 0;
  position: relative;
  transition: background-color 0.15s ease;
}

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

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

.wa-msg-row.selected {
  background-color: rgba(0, 168, 132, 0.08);
}

/* Checkbox en modo selección */
.msg-select-checkbox-wrap {
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.wa-msg-row.selection-mode .msg-select-checkbox-wrap {
  display: flex;
}

.msg-select-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.wa-msg-row.selected .msg-select-checkbox {
  background-color: var(--wa-green-deep);
  border-color: var(--wa-green-deep);
}

.wa-msg-row.selected .msg-select-checkbox::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.wa-bubble {
  max-width: 65%;
  min-width: 0;
  padding: 6px 9px 8px 9px;
  border-radius: 8px;
  position: relative;
  font-size: 14.2px;
  line-height: 19px;
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
  display: block;
}

@media (max-width: 768px) {
  .wa-bubble {
    max-width: 82%;
  }
}

body.mode-forced-mobile .wa-bubble {
  max-width: 82%;
}

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

.wa-msg-row.received .wa-bubble {
  background-color: var(--bubble-received);
  color: var(--bubble-received-text);
  border-top-left-radius: 0;
}

/* Flecha desplegable Chevron en hover sobre la burbuja */
.wa-bubble-chevron-btn {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  z-index: 5;
  transition: background-color 0.15s ease;
}

.wa-bubble:hover .wa-bubble-chevron-btn {
  display: flex;
}

.wa-bubble-chevron-btn:hover {
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
}

/* Pop-up Menú Contextual de Mensaje (Idéntico a WhatsApp Web) */
.wa-msg-context-menu {
  position: fixed;
  background: var(--dropdown-bg);
  min-width: 190px;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
  padding: 6px 0;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  animation: fadeInMenu 0.12s ease;
}

/* Nombre del autor en burbujas de grupo */
.wa-msg-author {
  font-size: 12.8px;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.2;
  display: block;
}

/* Pico de la burbuja (Tail) */
.wa-msg-row.sent .wa-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: var(--bubble-sent);
  border-left-color: var(--bubble-sent);
}

.wa-msg-row.received .wa-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: var(--bubble-received);
  border-right-color: var(--bubble-received);
}

/* Contenido */
.wa-bubble-text,
.wa-msg-text {
  user-select: text;
  word-break: break-word;
  white-space: pre-wrap;
}

.wa-msg-meta {
  float: right;
  margin-left: 8px;
  margin-top: 4px;
  margin-bottom: -3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 15px;
  color: var(--bubble-timestamp);
  white-space: nowrap;
  user-select: none;
}

/* Imagen adjunta */
.wa-msg-image-wrap {
  border-radius: 6px;
  overflow: hidden;
  margin: -2px -6px 4px -6px;
  max-width: 330px;
}

.wa-msg-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Foto 1 Sola Vez */
.wa-onetime-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.onetime-badge-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px dashed var(--wa-green-deep);
  color: var(--wa-green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.onetime-text {
  font-weight: 500;
  font-size: 14px;
}

/* REPRODUCTOR DE NOTA DE VOZ (WHATSAPP ORIGINAL) */
.wa-audio-bubble-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px;
  min-width: 290px;
  max-width: 350px;
  position: relative;
}

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

.wa-audio-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  overflow: hidden;
  background-color: var(--avatar-bg-default);
  color: var(--avatar-text-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.wa-audio-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.wa-audio-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.wa-audio-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease;
  padding: 0;
}

.audio-play-btn:hover {
  transform: scale(1.1);
}

.audio-play-btn svg {
  width: 30px;
  height: 30px;
}

.audio-waveform-track {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  height: 26px;
  cursor: pointer;
  padding-right: 12px;
}

.audio-bars-container {
  display: flex;
  align-items: center;
  gap: 2.5px;
  width: 100%;
  height: 100%;
}

.audio-bar {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  border-radius: 2px;
  background-color: var(--audio-bar-unplayed, #8696a0);
  transition: background-color 0.15s ease;
}

.audio-bar.played {
  background-color: #53bdeb;
}

.audio-scrubber-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #53bdeb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  transition: left 0.08s linear;
}

.wa-audio-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  line-height: 14px;
  color: var(--bubble-timestamp);
  user-select: none;
  padding-left: 42px;
}

.wa-audio-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Ticks de Lectura / Envío */
.tick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 4px;
  transition: transform 0.12s ease, opacity 0.12s ease;
  overflow: visible;
}

.wa-msg-row.sent .tick-icon:hover {
  transform: scale(1.2);
  opacity: 0.9;
}

.tick-icon svg {
  display: block;
  overflow: visible;
}

.tick-icon.blue {
  color: var(--wa-blue-tick);
}

.tick-icon.grey {
  color: var(--bubble-timestamp);
}

.wa-tick-state-btn {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-tick-state-btn .tick-icon {
  padding: 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.wa-tick-state-btn .tick-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Botón Peligro / Eliminar en Modales */
.btn-wa-danger-action {
  background: transparent;
  border: 1px solid var(--wa-red-hangup);
  color: var(--wa-red-hangup);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-wa-danger-action:hover {
  background: var(--wa-red-hangup);
  color: #ffffff;
}

/* =========================================================
   BARRA DE ESCRITURA INFERIOR & BOTÓN MORPH MIC/SEND
   ========================================================= */
.wa-input-panel {
  background-color: var(--bg-input-bar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 5;
}

.wa-input-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}

.wa-input-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.wa-input-icon-btn:hover {
  color: var(--text-primary);
}

.wa-textbox-wrapper {
  flex: 1;
  background-color: var(--bg-search);
  border-radius: 20px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
}

.wa-text-field {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--text-primary);
  resize: none;
  max-height: 100px;
  line-height: 20px;
  overflow-y: auto;
}

.wa-text-field::placeholder {
  color: var(--text-secondary);
}

/* Botón Circular Acción (Micrófono o Enviar) */
.wa-send-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--wa-green-deep);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.wa-send-action-btn:hover {
  background-color: var(--wa-green-hover);
  transform: scale(1.06);
}

/* Barra de Grabación de Audio en Vivo (WhatsApp Simulator) */
.wa-recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 12px;
  height: 58px;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg-input-bar);
  animation: fadeInRec 0.18s ease-out;
}

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

.wa-rec-btn-trash {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.wa-rec-btn-trash:hover {
  color: #ea0038;
  background-color: rgba(234, 0, 56, 0.12);
  transform: scale(1.08);
}

.wa-recording-timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 65px;
  flex-shrink: 0;
}

.recording-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ea0038;
  display: inline-block;
  animation: recDotPulse 1.2s infinite ease-in-out;
}

.recording-pulse-dot.paused {
  animation: none;
  opacity: 0.6;
}

@keyframes recDotPulse {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.5; }
}

.wa-recording-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  max-width: 220px;
  height: 24px;
  justify-content: center;
  overflow: hidden;
}

.wa-recording-waves .wave-bar {
  width: 3px;
  min-height: 4px;
  border-radius: 3px;
  background-color: var(--text-secondary);
  animation: recWaveMotion 1s ease-in-out infinite alternate;
}

.wa-recording-waves.paused .wave-bar {
  animation-play-state: paused;
}

.wa-recording-waves .wave-bar:nth-child(1) { height: 6px; animation-delay: 0.05s; }
.wa-recording-waves .wave-bar:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.wa-recording-waves .wave-bar:nth-child(3) { height: 18px; animation-delay: 0.25s; }
.wa-recording-waves .wave-bar:nth-child(4) { height: 10px; animation-delay: 0.35s; }
.wa-recording-waves .wave-bar:nth-child(5) { height: 22px; animation-delay: 0.45s; }
.wa-recording-waves .wave-bar:nth-child(6) { height: 14px; animation-delay: 0.1s; }
.wa-recording-waves .wave-bar:nth-child(7) { height: 8px; animation-delay: 0.2s; }
.wa-recording-waves .wave-bar:nth-child(8) { height: 20px; animation-delay: 0.3s; }
.wa-recording-waves .wave-bar:nth-child(9) { height: 16px; animation-delay: 0.4s; }
.wa-recording-waves .wave-bar:nth-child(10) { height: 11px; animation-delay: 0.5s; }
.wa-recording-waves .wave-bar:nth-child(11) { height: 19px; animation-delay: 0.12s; }
.wa-recording-waves .wave-bar:nth-child(12) { height: 7px; animation-delay: 0.22s; }
.wa-recording-waves .wave-bar:nth-child(13) { height: 15px; animation-delay: 0.32s; }
.wa-recording-waves .wave-bar:nth-child(14) { height: 10px; animation-delay: 0.42s; }
.wa-recording-waves .wave-bar:nth-child(15) { height: 6px; animation-delay: 0.52s; }

@keyframes recWaveMotion {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.3); }
}

.wa-rec-btn-pause {
  background: transparent;
  border: none;
  color: #ea0038;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.wa-rec-btn-pause:hover {
  background-color: rgba(234, 0, 56, 0.1);
  transform: scale(1.08);
}

/* =========================================================
   MENÚS DESPLEGABLES NATIVOS WHATSAPP (DROPDOWNS)
   ========================================================= */
.dropdown-wrapper {
  position: relative;
  display: inline-flex;
}

.wa-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--dropdown-bg);
  min-width: 220px;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  padding: 6px 0;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.wa-dropdown-menu.wa-dropdown-up {
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
}

.wa-dropdown-menu.show {
  display: flex;
  flex-direction: column;
  animation: fadeInMenu 0.15s ease;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease;
  white-space: nowrap;
}

.dropdown-item:hover {
  background-color: var(--dropdown-hover);
}

.dropdown-item svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.dropdown-exit-item {
  color: #ff6b81;
}

.dropdown-exit-item svg {
  color: #ff6b81;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* =========================================================
   MODALES NATIVOS WHATSAPP (POPUP DIALOGS)
   ========================================================= */
.wa-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wa-modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--modal-bg);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text-primary);
  animation: modalScale 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.wa-modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--modal-header-bg);
  border-bottom: 1px solid var(--border-color);
}

.wa-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.wa-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.wa-modal-close-btn:hover {
  color: var(--text-primary);
}

.wa-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

.contact-avatar-picker-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 6px;
}

.contact-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  background: var(--avatar-bg-default);
  color: var(--avatar-text-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  overflow: hidden;
  border: none;
  flex-shrink: 0;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.contact-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.avatar-upload-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-wa-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #2a3942;
  color: #e9edef;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s ease;
}

.btn-wa-action:hover {
  background: #374248;
}

.btn-wa-danger-link {
  background: transparent;
  border: none;
  color: #ea0038;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}

.wa-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wa-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wa-form-input,
.wa-form-select,
.wa-form-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

.wa-form-textarea {
  min-height: 64px;
  resize: vertical;
  display: block;
}

.wa-form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-search);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238696a0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

body.theme-light .wa-form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667781' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.wa-form-select option {
  background-color: var(--dropdown-bg);
  color: var(--text-primary);
}

.wa-form-input:focus,
.wa-form-select:focus,
.wa-form-textarea:focus {
  border-color: var(--wa-green-deep);
}

.wa-info-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.wa-info-icon-btn:hover {
  color: var(--wa-green-deep);
  background: rgba(0, 168, 132, 0.15);
}

.wa-info-notice {
  background: rgba(0, 168, 132, 0.12);
  border-left: 3px solid var(--wa-green-deep);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  border-radius: 4px;
}

.wa-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14.5px;
  font-weight: 500;
}

.ios-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374248;
  transition: .25s;
  border-radius: 24px;
}

.ios-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}

input:checked + .ios-slider {
  background-color: var(--wa-green-deep);
}

input:checked + .ios-slider:before {
  transform: translateX(20px);
}

.wa-modal-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--modal-header-bg);
  border-top: 1px solid var(--border-color);
}

.btn-wa-cancel {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-wa-cancel:hover {
  color: var(--text-primary);
}

.btn-wa-save {
  background: var(--wa-green-deep);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-wa-save:hover {
  background: var(--wa-green-hover);
}

/* =========================================================
   GRUPO MIEMBROS & PARTICIPANTES
   ========================================================= */
.group-members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.group-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.member-chip-remove {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.member-chip-remove:hover {
  color: var(--wa-red-hangup);
}

.add-member-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* =========================================================
   CONSTRUCTOR DE PASOS AUTOMATIZADOS (STEP BUILDER)
   ========================================================= */
.auto-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.auto-step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
}

.auto-step-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.auto-step-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.step-sender-name {
  font-weight: 600;
}

.step-trigger-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: var(--font-family);
}

.step-trigger-toggle-btn:hover {
  border-color: var(--wa-green-deep);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.step-trigger-toggle-btn.active {
  background: rgba(0, 168, 132, 0.18);
  border-color: var(--wa-green-deep);
  color: var(--wa-green-deep);
  font-weight: 600;
}

.step-trigger-toggle-btn svg {
  flex-shrink: 0;
}

.step-detail-text {
  color: var(--text-secondary);
  font-size: 12px;
  word-break: break-word;
}

.step-edit-btn,
.step-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.step-edit-btn:hover {
  color: var(--wa-green-deep);
  background: rgba(0, 168, 132, 0.15);
}

.step-remove-btn:hover {
  color: var(--wa-red-hangup);
  background: rgba(234, 0, 56, 0.15);
}

.add-step-builder-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
}

.step-builder-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--wa-green-deep);
}

.step-builder-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.step-builder-row > .wa-form-group {
  flex: 1 1 180px;
  min-width: 0;
  box-sizing: border-box;
}

/* =========================================================
   OVERLAYS DE LLAMADA & VIDEOLLAMADA
   ========================================================= */
.call-overlay,
.videocall-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 20, 26, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.call-card {
  width: 100%;
  max-width: 360px;
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
}

.call-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #8696a0;
  margin-bottom: 12px;
}

.call-contact-name {
  font-size: 24px;
  font-weight: 600;
  color: #e9edef;
  margin-bottom: 4px;
}

.call-status-label {
  font-size: 14px;
  color: #8696a0;
}

.call-avatar-wrap {
  position: relative;
}

.call-avatar-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  background: var(--avatar-bg-default);
  color: var(--avatar-text-default);
  font-size: 42px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: none;
  box-shadow: 0 0 30px rgba(0, 168, 132, 0.2);
  animation: pulseAvatar 2.5s infinite;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.call-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

@keyframes pulseAvatar {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 168, 132, 0.4); }
  70% { transform: scale(1.04); box-shadow: 0 0 0 20px rgba(0, 168, 132, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 168, 132, 0); }
}

.call-actions-dock {
  display: flex;
  align-items: center;
  gap: 20px;
}

.call-dock-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #202c33;
  color: #e9edef;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.call-dock-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

.call-dock-btn:hover {
  background: #2a3942;
}

.call-btn-hangup {
  background: var(--wa-red-hangup) !important;
  color: #ffffff !important;
  width: 60px;
  height: 60px;
  box-shadow: 0 4px 16px rgba(234, 0, 56, 0.4);
}

.call-btn-hangup:hover {
  transform: scale(1.08);
}

/* Videollamada Screen */
.videocall-screen {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #111b21;
}

.videocall-bg-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(circle, #202c33 0%, #0b141a 100%);
}

.videocall-caller-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  background: var(--avatar-bg-default);
  color: var(--avatar-text-default);
  font-size: 38px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: none;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.4);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.videocall-caller-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.videocall-caller-info {
  text-align: center;
}

.videocall-caller-info h3 {
  font-size: 22px;
  color: #e9edef;
  margin-bottom: 4px;
}

.videocall-caller-info span {
  font-size: 13.5px;
  color: #8696a0;
}

.videocall-self-pip {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 100px;
  height: 140px;
  background: #202c33;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pip-inner {
  font-size: 13px;
  font-weight: 600;
  color: #8696a0;
}

.videocall-controls-bar {
  height: 80px;
  background: rgba(11, 20, 26, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

/* =========================================================
   TEMA CLARO EN LLAMADAS Y VIDEOLLAMADAS
   ========================================================= */
body.theme-light .call-overlay {
  background: rgba(240, 242, 245, 0.96);
}

body.theme-light .call-security-badge {
  color: #667781;
}

body.theme-light .call-contact-name {
  color: #111b21;
}

body.theme-light .call-status-label {
  color: #667781;
}

body.theme-light .call-avatar-circle {
  background: #dfe5e7;
  color: #54656f;
  box-shadow: 0 0 30px rgba(0, 128, 105, 0.2);
}

body.theme-light .call-dock-btn {
  background: #ffffff;
  color: #111b21;
  border: 1px solid #e9edef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.theme-light .call-dock-btn:hover {
  background: #e9edef;
}

body.theme-light .videocall-overlay {
  background: rgba(240, 242, 245, 0.96);
}

body.theme-light .videocall-screen {
  background: #efeae2;
}

body.theme-light .videocall-bg-placeholder {
  background: radial-gradient(circle, #f0f2f5 0%, #d1d7db 100%);
}

body.theme-light .videocall-caller-info h3,
body.theme-light .videocall-caller-name h3 {
  color: #111b21 !important;
}

body.theme-light .videocall-caller-info span,
body.theme-light .videocall-caller-name span {
  color: #667781 !important;
}

body.theme-light .videocall-avatar-circle {
  background: #dfe5e7;
  color: #54656f;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

body.theme-light .videocall-self-pip {
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

body.theme-light .videocall-self-pip .pip-inner {
  color: #54656f;
}

body.theme-light .videocall-controls-bar {
  background: rgba(240, 242, 245, 0.95);
  border-top: 1px solid #e9edef;
}

body.theme-light .videocall-controls-bar .call-dock-btn {
  background: #ffffff;
  color: #111b21;
  border: 1px solid #e9edef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.theme-light .videocall-controls-bar .call-dock-btn:hover {
  background: #e9edef;
}
