/* ========================================================
   RHWhatsApp - WhatsApp Web Authentic Stylesheet
   ======================================================== */

:root {
  /* WhatsApp Modern Theme (Default) */
  --wa-bg-app: #080d11;
  --wa-bg-panel: #0d151c;
  --wa-bg-header: #121e27;
  --wa-bg-search: #121e27;
  --wa-bg-search-input: #080d11;
  --wa-bg-chat: #090e13;
  --wa-bg-chat-bubble-in: #1a2730;
  --wa-bg-chat-bubble-out: #005c4b;
  --wa-bg-hover: rgba(255, 255, 255, 0.04);
  --wa-bg-active: rgba(16, 185, 129, 0.12);
  --wa-bg-input: #15222c;
  --wa-bg-dropdown: #16242e;
  --wa-bg-modal: #0d151c;

  --wa-primary: #10b981;
  --wa-primary-hover: #059669;
  --wa-primary-light: rgba(16, 185, 129, 0.15);

  --wa-text-primary: #f1f5f9;
  --wa-text-secondary: #94a3b8;
  --wa-text-muted: #64748b;
  --wa-text-link: #38bdf8;

  --wa-border: rgba(255, 255, 255, 0.08);
  --wa-border-light: rgba(255, 255, 255, 0.12);

  --wa-badge-unread: #10b981;
  --wa-badge-unread-text: #080d11;

  --wa-tick-gray: #94a3b8;
  --wa-tick-blue: #38bdf8;

  --wa-status-online: #10b981;
  --wa-status-offline: #f43f5e;
  --wa-status-connecting: #f59e0b;

  --wa-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --wa-shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
  --wa-shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.6);

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Light Theme Variables */
body.light-theme {
  --wa-bg-app: #f1f5f9;
  --wa-bg-panel: #ffffff;
  --wa-bg-header: #f8fafc;
  --wa-bg-search: #f8fafc;
  --wa-bg-search-input: #f1f5f9;
  --wa-bg-chat: #f8fafc;
  --wa-bg-chat-bubble-in: #ffffff;
  --wa-bg-chat-bubble-out: #d9fdd3;
  --wa-bg-hover: #f1f5f9;
  --wa-bg-active: rgba(16, 185, 129, 0.1);
  --wa-bg-input: #f8fafc;
  --wa-bg-dropdown: #ffffff;
  --wa-bg-modal: #ffffff;

  --wa-primary: #059669;
  --wa-primary-hover: #047857;
  --wa-primary-light: rgba(16, 185, 129, 0.12);

  --wa-text-primary: #0f172a;
  --wa-text-secondary: #475569;
  --wa-text-muted: #94a3b8;
  --wa-text-link: #0284c7;

  --wa-border: #e2e8f0;
  --wa-border-light: #cbd5e1;

  --wa-badge-unread: #10b981;
  --wa-badge-unread-text: #ffffff;

  --wa-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --wa-shadow-md: 0 4px 10px rgba(0, 0, 0, 0.07);
  --wa-shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--wa-bg-app);
  color: var(--wa-text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}

/* Main WhatsApp Application Shell */
.app-container {
  width: 100vw;
  height: 100vh;
  max-width: 1700px;
  background-color: var(--wa-bg-panel);
  display: flex;
  overflow: hidden;
  position: relative;
  box-shadow: var(--wa-shadow-lg);
}

@media (min-width: 1441px) {
  .app-container {
    height: calc(100vh - 38px);
    width: calc(100vw - 38px);
    border-radius: 8px;
  }
}

/* ========================================================
   LEFT SIDEBAR (Chats List & Navigation)
   ======================================================== */
.sidebar {
  width: 420px;
  min-width: 340px;
  max-width: 500px;
  height: 100%;
  background-color: var(--wa-bg-panel);
  border-right: 1px solid var(--wa-border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  position: relative;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.avatar-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #374248;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--wa-bg-header);
  background-color: var(--wa-status-online);
}

.status-dot.offline {
  background-color: var(--wa-status-offline);
}

.status-dot.connecting {
  background-color: var(--wa-status-connecting);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--wa-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 10px;
  background-color: var(--wa-primary-light);
  color: var(--wa-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-status {
  font-size: 11px;
  color: var(--wa-text-secondary);
}

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

.icon-btn {
  background: none;
  border: none;
  color: var(--wa-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, color 0.15s ease;
  position: relative;
}

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

.icon-btn.active {
  color: var(--wa-primary);
  background-color: var(--wa-primary-light);
}

.badge-counter {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: var(--wa-primary);
  color: #111b21;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

/* Top Connection Status Bar */
.connection-summary-bar {
  background-color: #182229;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--wa-border);
  font-size: 12px;
}

body.light-theme .connection-summary-bar {
  background-color: #f7f9fa;
}

.connections-status-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.connections-status-chips::-webkit-scrollbar {
  display: none;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  background-color: var(--wa-bg-header);
  border: 1px solid var(--wa-border);
  color: var(--wa-text-primary);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.session-chip:hover {
  border-color: var(--wa-primary);
}

.session-chip.active-filter {
  background-color: var(--wa-primary);
  color: #111b21;
  font-weight: 600;
  border-color: var(--wa-primary);
}

.session-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--wa-status-online);
}

.session-chip .chip-dot.disconnected {
  background-color: var(--wa-status-offline);
}

.session-chip .chip-dot.connecting {
  background-color: var(--wa-status-connecting);
}

.btn-open-connections {
  background: var(--wa-primary-light);
  color: var(--wa-primary);
  border: 1px solid rgba(0, 168, 132, 0.3);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-open-connections:hover {
  background: var(--wa-primary);
  color: #111b21;
}

/* Sidebar Search & Filters */
.search-container {
  padding: 8px 12px;
  background-color: var(--wa-bg-panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--wa-border);
}

.search-box {
  background-color: var(--wa-bg-search);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 36px;
  gap: 10px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--wa-primary);
  background-color: var(--wa-bg-search-input);
}

.search-box svg {
  color: var(--wa-text-secondary);
  flex-shrink: 0;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  width: 100%;
  color: var(--wa-text-primary);
  font-size: 14px;
}

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

.filter-pills {
  display: flex;
  gap: 6px;
  padding: 2px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

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

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

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

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

/* Chat List Items */
.chat-list {
  flex: 1;
  overflow-y: auto;
  background-color: var(--wa-bg-panel);
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
}

.chat-item {
  display: flex;
  align-items: flex-start;
  min-height: 72px;
  height: auto;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.12s ease;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

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

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 2px 14px 0 0;
  flex-shrink: 0;
  overflow: hidden;
  background-color: #374248;
  cursor: pointer;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.chat-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.chat-identidade {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.chat-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--wa-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.chat-header-left { cursor: pointer; }
.chat-subnome {
  font-size: 12px;
  color: var(--wa-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 12px;
  color: var(--wa-text-secondary);
  flex-shrink: 0;
  margin-left: 8px;
}

.chat-item.unread .chat-time {
  color: var(--wa-badge-unread);
  font-weight: 500;
}

.chat-row-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.chat-preview {
  font-size: 13.5px;
  color: var(--wa-text-secondary);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.chat-preview span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-badges-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.chat-item .etiqueta-mini {
  margin: 0;
  max-width: 140px;
  padding: 2px 8px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Account tag on chat card */
.account-tag-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: rgba(0, 168, 132, 0.16);
  color: var(--wa-primary);
  border: 1px solid rgba(0, 168, 132, 0.25);
  white-space: nowrap;
}

.unread-count {
  background-color: var(--wa-badge-unread);
  color: var(--wa-badge-unread-text);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.pin-icon {
  color: var(--wa-text-secondary);
  font-size: 13px;
}

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

/* WhatsApp Background Pattern */
.chat-background-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.055;
  background-image: radial-gradient(#ffffff 0.75px, transparent 0.75px), radial-gradient(#ffffff 0.75px, #0b141a 0.75px);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  pointer-events: none;
  z-index: 1;
}

body.light-theme .chat-background-pattern {
  opacity: 0.12;
  background-image: radial-gradient(#000000 0.8px, transparent 0.8px), radial-gradient(#000000 0.8px, #efeae2 0.8px);
}

/* Empty State / Welcome Screen */
.empty-chat-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  z-index: 2;
  border-bottom: 6px solid var(--wa-primary);
}

.empty-chat-screen .hero-illustration {
  width: 320px;
  max-width: 80%;
  margin-bottom: 28px;
  opacity: 0.85;
}

.empty-chat-screen h2 {
  font-size: 28px;
  font-weight: 300;
  color: var(--wa-text-primary);
  margin-bottom: 12px;
}

.empty-chat-screen p {
  font-size: 14px;
  color: var(--wa-text-secondary);
  max-width: 480px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.empty-chat-screen .e2e-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--wa-text-muted);
}

/* Active Chat Header */
.chat-header {
  height: 60px;
  background-color: var(--wa-bg-header);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--wa-border);
  z-index: 5;
  position: relative;
}

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

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #374248;
  flex-shrink: 0;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.chat-header-subtitle {
  font-size: 12px;
  color: var(--wa-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-subtitle.online {
  color: var(--wa-status-online);
}

.chat-header-subtitle.typing {
  color: var(--wa-primary);
  font-weight: 500;
}

/* ========================================================
   CONNECTION STATUS IN CHAT HEADER (User Request Requirement)
   ======================================================== */
.chat-header-connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background-color: rgba(0, 168, 132, 0.12);
  border: 1px solid rgba(0, 168, 132, 0.3);
  margin-right: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-header-connection-pill:hover {
  background-color: rgba(0, 168, 132, 0.22);
}

.chat-header-connection-pill.disconnected {
  background-color: rgba(234, 67, 53, 0.15);
  border-color: rgba(234, 67, 53, 0.35);
}

.chat-header-connection-pill.connecting {
  background-color: rgba(251, 188, 5, 0.15);
  border-color: rgba(251, 188, 5, 0.35);
}

.connection-pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--wa-status-online);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

.chat-header-connection-pill.disconnected .connection-pill-dot {
  background-color: var(--wa-status-offline);
  animation: none;
}

.chat-header-connection-pill.connecting .connection-pill-dot {
  background-color: var(--wa-status-connecting);
}

.connection-pill-text {
  display: flex;
  flex-direction: column;
}

.connection-pill-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--wa-text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.connection-pill-number {
  font-size: 10px;
  color: var(--wa-text-secondary);
}

.connection-pill-chevron {
  color: var(--wa-text-secondary);
  font-size: 11px;
}

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

/* Disconnected Account Alert Banner */
.disconnected-warning-banner {
  background-color: #3b2023;
  color: #ff9b9b;
  padding: 8px 16px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(234, 67, 53, 0.3);
  z-index: 5;
}

.btn-banner-reconnect {
  background-color: #ea4335;
  color: #ffffff;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ========================================================
   MESSAGES STREAM CONTAINER
   ======================================================== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 50px 16px 50px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
  position: relative;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Date Marker Chips */
.date-divider {
  display: flex;
  justify-content: center;
  margin: 12px 0 8px 0;
}

.date-divider span {
  background-color: var(--wa-bg-header);
  color: var(--wa-text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 7.5px;
  box-shadow: var(--wa-shadow-sm);
  text-transform: uppercase;
}

/* End-to-End Encryption Notice */
.encryption-notice {
  background-color: #182229;
  color: #ffd279;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  text-align: center;
  margin: 8px auto 14px auto;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--wa-shadow-sm);
}

body.light-theme .encryption-notice {
  background-color: #ffeecd;
  color: #54656f;
}

/* Message Bubbles - Modernized */
.message-bubble {
  max-width: 65%;
  min-width: 90px;
  padding: 8px 12px 6px 12px;
  border-radius: 16px;
  position: relative;
  font-size: 14.5px;
  line-height: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  word-wrap: break-word;
  animation: fadeIn 0.18s ease-out;
  margin-bottom: 4px;
  transition: transform 0.1s ease;
}

.message-in {
  align-self: flex-start;
  background-color: #1a2730;
  color: var(--wa-text-primary);
  border-radius: 16px 16px 16px 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.message-out {
  align-self: flex-end;
  background: linear-gradient(135deg, #005c4b 0%, #00755e 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 8px rgba(0, 92, 75, 0.35);
}

body.light-theme .message-in {
  background-color: #ffffff;
  color: #111b21;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .message-out {
  background: linear-gradient(135deg, #d9fdd3 0%, #c6f8bd 100%);
  color: #111b21;
  border: 1px solid rgba(0, 168, 132, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.message-in::before, .message-out::before {
  display: none;
}

/* Notas Internas e de Encerramento Modernas */
.nota-interna {
  align-self: center;
  max-width: 480px;
  margin: 12px auto;
  padding: 12px 18px;
  text-align: center;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px;
  color: #fca5a5;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
  backdrop-filter: blur(8px);
}
.nota-interna strong {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.nota-interna p { margin: 0; color: #fee2e2; font-size: 13.5px; line-height: 1.45; }
.nota-interna span { display: block; margin-top: 6px; font-size: 11px; opacity: 0.75; }

.nota-encerramento {
  align-self: center;
  max-width: 480px;
  margin: 12px auto;
  padding: 12px 18px;
  text-align: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  color: #fde68a;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
  backdrop-filter: blur(8px);
}
.nota-encerramento strong {
  display: block;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.nota-encerramento p { margin: 0; color: #fef3c7; font-size: 13.5px; line-height: 1.45; }
.nota-encerramento span { display: block; margin-top: 6px; font-size: 11px; opacity: 0.75; }

/* Sub-cabeçalho de Status do Chat Ativo */
.chat-header-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 20px;
  background: var(--wa-bg-header);
  border-bottom: 1px solid var(--wa-border);
}
.chat-header-marcas, .chat-header-status-acoes, .chat-header-vinculos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.vinculo-candidato {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--wa-text-primary);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--wa-border);
}
.vinculo-candidato select, .chat-status-campo select {
  background: var(--wa-bg-input);
  color: var(--wa-text-primary);
  border: 1px solid var(--wa-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.chat-vinculos-previa {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--wa-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-etiquetas { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.chat-sem-etiqueta { font-size: 12px; color: var(--wa-text-muted); }
.chat-status-campo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--wa-text-secondary);
  flex-shrink: 0;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: #e542a3;
  margin-bottom: 2px;
}

.message-account-source {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  background-color: rgba(0, 0, 0, 0.2);
  padding: 1px 5px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 4px;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Message Footer (Time & Status Ticks) */
.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  margin-left: 14px;
  float: right;
  position: relative;
  top: 4px;
}

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

.message-out .message-time {
  color: rgba(255, 255, 255, 0.6);
}

.message-status-coluna {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.icone-celular {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5c451;
  color: #3b2a00;
  box-shadow: 0 0 0 2px rgba(245, 196, 81, 0.45);
}

.motivo-falha {
  clear: both;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
}

.message-status-tick {
  display: inline-flex;
  align-items: center;
}

.message-status-tick svg {
  width: 16px;
  height: 16px;
}

.tick-pending {
  color: rgba(255, 255, 255, 0.4);
}

.tick-sent {
  color: rgba(255, 255, 255, 0.6);
}

.tick-delivered {
  color: rgba(255, 255, 255, 0.6);
}

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

/* Media Messages (Images) */
.message-image {
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
  cursor: pointer;
  max-width: 330px;
}

.message-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  transition: transform 0.2s;
}

.message-image img:hover {
  transform: scale(1.01);
}

/* Audio Voice Note Messages */
.message-audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  padding: 4px 0;
}

.audio-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--wa-primary);
  color: #111b21;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

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

.audio-waveform-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audio-waveform-visual {
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.audio-bar {
  width: 3px;
  background-color: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  transition: background-color 0.1s;
}

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

.audio-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--wa-text-secondary);
}

.audio-speed-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--wa-text-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}

/* Document Messages */
.message-document {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px;
  border-radius: 6px;
  min-width: 220px;
}

.document-icon {
  font-size: 26px;
  color: var(--wa-primary);
}

.document-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.document-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--wa-text-primary);
}

.document-size {
  font-size: 11px;
  color: var(--wa-text-secondary);
}

/* ========================================================
   CHAT FOOTER / INPUT BAR
   ======================================================== */
.chat-footer {
  min-height: 62px;
  background-color: var(--wa-bg-header);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--wa-border);
  z-index: 5;
  position: relative;
}

.input-actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-input-wrapper {
  flex: 1;
  background-color: var(--wa-bg-input);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 8px 14px;
  min-height: 42px;
  max-height: 120px;
}

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

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

.input-actions-right {
  display: flex;
  align-items: center;
}

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

.send-btn.has-text {
  background-color: var(--wa-primary);
  color: #111b21;
}

.send-btn:hover {
  transform: scale(1.05);
}

/* Voice Recording Bar (inside Chat Footer when active) */
.voice-recording-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ea4335;
  font-size: 14px;
  font-weight: 500;
}

.recording-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ea4335;
  animation: pulse 1s infinite;
}

.recording-timer {
  font-family: monospace;
  font-size: 15px;
  color: var(--wa-text-primary);
}

.recording-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-cancel-recording {
  background: none;
  border: none;
  color: #ea4335;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-send-recording {
  background-color: var(--wa-primary);
  color: #111b21;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
