/* src/global/css/components/chat.css */

.chat-container-fullscreen {
  display: flex;
  height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  border: none;
  border-radius: 0;
}

.chat-layout-whatsapp {
  display: grid;
  grid-template-columns: 72px 350px 1fr !important;
  height: 100%;
  width: 100%;
  transition: grid-template-columns 0.25s ease-in-out;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
}

.chat-layout-whatsapp.show-right-panel {
  grid-template-columns: 72px 350px 1fr 350px !important;
}

/* SIDEBAR PASTAS / FILTROS */
.chat-folder-bar {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 2px;
  user-select: none;
  box-sizing: border-box;
  overflow-y: auto;
}

.folder-item {
  width: 100%;
  padding: 12px 4px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
  background: transparent;
  box-sizing: border-box;
  position: relative;
}

.folder-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
}

.folder-item.active {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9) !important;
}

.folder-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-icon svg {
  fill: currentColor;
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.folder-icon svg.owl-icon,
svg.owl-icon {
  fill: none !important;
}

.folder-icon svg.owl-icon .owl-pupil,
svg.owl-icon .owl-pupil {
  fill: currentColor !important;
  stroke: none !important;
}

.folder-icon svg.owl-icon polygon,
svg.owl-icon polygon,
.owl-beak {
  fill: #f59e0b !important;
  stroke: #f59e0b !important;
}

.folder-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.folder-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 14px;
  text-align: center;
  line-height: 1.2;
}

.folder-item.active .folder-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* SIDEBAR LISTA DE CHATS */
.chat-sidebar {
  width: 350px !important;
  min-width: 350px !important;
  max-width: 350px !important;
  box-sizing: border-box !important;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: none !important;
}

.sidebar-search {
  height: 65px !important;
  min-height: 65px !important;
  max-height: 65px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  border-bottom: 1px solid var(--glass-border) !important;
  padding: 0 20px !important;
}

.sidebar-search input {
  width: 100%;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  color: var(--text-color);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-list::-webkit-scrollbar {
  width: 4px;
}

.chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

.chat-list-item {
  display: flex;
  align-items: center;
  padding: 14px 20px !important;
  gap: 14px !important;
  cursor: pointer;
  border-bottom: none;
  transition: background 0.2s;
}

.chat-list-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.chat-list-item.active {
  background: rgba(255, 255, 255, 0.08);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.chat-avatar img {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

.chat-preview {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chat-name,
.chat-item-name {
  font-size: 15px;
  font-weight: 700 !important;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-last-msg {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN CHAT AREA */
.chat-main {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.chat-topbar {
  height: 65px !important;
  min-height: 65px !important;
  max-height: 65px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 20px !important;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--glass-border) !important;
  flex-shrink: 0;
}

.chat-ch-info {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.chat-ch-avatar,
#mainAvatar {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  max-width: 42px !important;
  max-height: 42px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

.chat-ch-avatar img,
#mainAvatar img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  display: block !important;
}

.chat-ch-name {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 2px;
}

.chat-online {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-color) !important;
  opacity: 0.9;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.online-dot.offline,
.online-dot-small.offline {
  background-color: #888888 !important;
  box-shadow: none !important;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h100v100H0z" fill="none"/><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.03)"/></svg>');
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.msg {
  display: flex;
  gap: 12px;
  max-width: 50%;
  align-self: flex-start;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
  align-items: center;
}

.msg.mine {
  align-self: flex-end;
}

.msg-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-color);
  flex-shrink: 0;
  font-weight: bold;
}

.msg-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-sender-name {
  font-size: 12px;
  color: var(--petal-color);
  font-weight: 500;
  margin-bottom: 4px;
}

.msg-time {
  font-size: 10px;
  opacity: 0.6;
  float: right;
  margin-top: 6px;
  margin-left: 12px;
}

.msg-bubble {
  padding: 6px 12px;
  width: fit-content;
  max-width: 100%;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-color);
  background: transparent !important;
  backdrop-filter: none !important;
  border: 1px solid var(--glass-border);
  border-radius: 4px 16px 16px 16px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  word-break: break-word;
  overflow-wrap: break-word;
}

.msg-bubble::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(8px) !important;
  border-radius: inherit !important;
  z-index: -2 !important;
  pointer-events: none !important;
}

.msg.mine .msg-bubble {
  background: transparent !important;
  backdrop-filter: none !important;
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.msg.mine .msg-bubble::before {
  background: var(--glass-bg) !important;
}

/* TYPING INDICATOR */
.typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  min-height: 30px;
}

.typing.hidden {
  visibility: hidden;
}

.t-dots {
  display: flex;
  gap: 4px;
}

.t-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite;
}

.t-dot:nth-child(2) {
  animation-delay: .2s;
}

.t-dot:nth-child(3) {
  animation-delay: .4s;
}

.t-label {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* INPUT ROW */
.input-row {
  padding: 6px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 8px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 40px;
}

.msg-input,
#chatInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-family: 'Montserrat', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif !important;
  font-size: 14px;
  padding: 2px 0;
  margin: 0;
  outline: none;
  resize: none;
  height: 24px;
  min-height: 24px;
  max-height: 200px;
  line-height: 1.4;
  overflow-y: hidden;
  box-sizing: border-box;
  field-sizing: content;
}

.msg-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.chat-send-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  flex-shrink: 0;
  margin-bottom: 0;
}

.chat-send-btn:disabled {
  color: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
  transform: none;
}

/* CARGO BUBBLE BORDERS AND GLOWS */
.msg-bubble.cargo-fundador,
.msg .msg-bubble.cargo-fundador,
.msg.mine .msg-bubble.cargo-fundador {
  border: 1.5px solid #ff5d00 !important;
  position: relative !important;
}

.msg-bubble.cargo-fundador::after,
.msg .msg-bubble.cargo-fundador::after,
.msg.mine .msg-bubble.cargo-fundador::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: inherit !important;
  z-index: 1 !important;
  animation: flame-pulse-glow 2s infinite ease-in-out !important;
  pointer-events: none !important;
  box-shadow: 0 0 20px rgba(255, 93, 0, 0.4) !important;
}

.msg-bubble.cargo-duque,
.msg .msg-bubble.cargo-duque,
.msg.mine .msg-bubble.cargo-duque {
  border: 1.5px solid #00f0ff !important;
  position: relative !important;
}

.msg-bubble.cargo-duque::after,
.msg .msg-bubble.cargo-duque::after,
.msg.mine .msg-bubble.cargo-duque::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: inherit !important;
  z-index: 1 !important;
  animation: diamond-pulse-glow-duque 3s infinite ease-in-out !important;
  pointer-events: none !important;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4) !important;
}

.msg-bubble.cargo-conde,
.msg .msg-bubble.cargo-conde,
.msg.mine .msg-bubble.cargo-conde {
  border: 1.2px solid #00d8f6 !important;
  position: relative !important;
}

.msg-bubble.cargo-conde::after,
.msg .msg-bubble.cargo-conde::after,
.msg.mine .msg-bubble.cargo-conde::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: inherit !important;
  z-index: 1 !important;
  animation: diamond-pulse-glow-conde 3s infinite ease-in-out !important;
  pointer-events: none !important;
  box-shadow: 0 0 15px rgba(0, 216, 246, 0.3) !important;
}

.msg-bubble.cargo-marques,
.msg .msg-bubble.cargo-marques,
.msg.mine .msg-bubble.cargo-marques {
  border: 1px solid #00bfff !important;
  position: relative !important;
}

.msg-bubble.cargo-marques::after,
.msg .msg-bubble.cargo-marques::after,
.msg.mine .msg-bubble.cargo-marques::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: inherit !important;
  z-index: 1 !important;
  animation: diamond-pulse-glow-marques 3s infinite ease-in-out !important;
  pointer-events: none !important;
  box-shadow: 0 0 12px rgba(0, 191, 255, 0.25) !important;
}

.msg-bubble.cargo-barao,
.msg .msg-bubble.cargo-barao,
.msg.mine .msg-bubble.cargo-barao {
  border: 1px solid #0088ff !important;
  position: relative !important;
}

.msg-bubble.cargo-barao::after,
.msg .msg-bubble.cargo-barao::after,
.msg.mine .msg-bubble.cargo-barao::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: inherit !important;
  z-index: 1 !important;
  animation: diamond-pulse-glow-barao 3s infinite ease-in-out !important;
  pointer-events: none !important;
  box-shadow: 0 0 8px rgba(0, 136, 255, 0.2) !important;
}

.msg-bubble.cargo-sistema,
.msg .msg-bubble.cargo-sistema,
.msg.mine .msg-bubble.cargo-sistema {
  border: 1px solid rgba(16, 185, 129, 0.7) !important;
  position: relative !important;
}

.msg-bubble.cargo-sistema::after,
.msg .msg-bubble.cargo-sistema::after,
.msg.mine .msg-bubble.cargo-sistema::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: inherit !important;
  z-index: 1 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5) !important;
  pointer-events: none !important;
}

/* HALOS DE PERFIL NOS CARGOS */
.chat-item-av,
.msg-av,
#rpAvatarContainer,
#perfil-avatar-preview,
#mainAvatar,
.conselho-avatar,
.header-avatar-btn,
.gmenu-avatar-wrap {
  border-radius: 50% !important;
  transition: outline 0.3s ease, box-shadow 0.3s ease;
}

.chat-item-av.cargo-fundador,
.msg-av.cargo-fundador,
#rpAvatarContainer.cargo-fundador,
#perfil-avatar-preview.cargo-fundador,
#mainAvatar.cargo-fundador,
.conselho-avatar.cargo-fundador,
.header-avatar-btn.cargo-fundador,
.gmenu-avatar-wrap.cargo-fundador {
  outline: 2px solid #ff5d00 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 12px 2px rgba(255, 93, 0, 0.65) !important;
}

.chat-item-av.cargo-duque,
.msg-av.cargo-duque,
#rpAvatarContainer.cargo-duque,
#perfil-avatar-preview.cargo-duque,
#mainAvatar.cargo-duque,
.conselho-avatar.cargo-duque,
.header-avatar-btn.cargo-duque,
.gmenu-avatar-wrap.cargo-duque {
  outline: 2px solid #00f0ff !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 12px 2px rgba(0, 240, 255, 0.65) !important;
}

.chat-item-av.cargo-conde,
.msg-av.cargo-conde,
#rpAvatarContainer.cargo-conde,
#perfil-avatar-preview.cargo-conde,
#mainAvatar.cargo-conde,
.conselho-avatar.cargo-conde,
.header-avatar-btn.cargo-conde,
.gmenu-avatar-wrap.cargo-conde {
  outline: 2px solid #00d8f6 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 10px 2px rgba(0, 216, 246, 0.55) !important;
}

.chat-item-av.cargo-marques,
.msg-av.cargo-marques,
#rpAvatarContainer.cargo-marques,
#perfil-avatar-preview.cargo-marques,
#mainAvatar.cargo-marques,
.conselho-avatar.cargo-marques,
.header-avatar-btn.cargo-marques,
.gmenu-avatar-wrap.cargo-marques {
  outline: 2px solid #00bfff !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 10px 2px rgba(0, 191, 255, 0.5) !important;
}

.chat-item-av.cargo-barao,
.msg-av.cargo-barao,
#rpAvatarContainer.cargo-barao,
#perfil-avatar-preview.cargo-barao,
#mainAvatar.cargo-barao,
.conselho-avatar.cargo-barao,
.header-avatar-btn.cargo-barao,
.gmenu-avatar-wrap.cargo-barao {
  outline: 2px solid #0088ff !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 10px 2px rgba(0, 136, 255, 0.45) !important;
}

.chat-item-av.cargo-sistema,
.msg-av.cargo-sistema,
#rpAvatarContainer.cargo-sistema,
#perfil-avatar-preview.cargo-sistema,
#mainAvatar.cargo-sistema,
.conselho-avatar.cargo-sistema,
.header-avatar-btn.cargo-sistema,
.gmenu-avatar-wrap.cargo-sistema {
  outline: 2px solid #ff5d00 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 12px 2px rgba(255, 93, 0, 0.65) !important;
}

/* PAINEL RIGHT CHAT */
.chat-right-panel {
  width: 350px !important;
  min-width: 350px !important;
  max-width: 350px !important;
  box-sizing: border-box !important;
  border-left: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.chat-right-panel::-webkit-scrollbar {
  width: 4px;
}

.chat-right-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

.right-panel-header {
  height: 65px !important;
  min-height: 65px !important;
  max-height: 65px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  border-bottom: 1px solid var(--glass-border) !important;
  padding: 0 20px !important;
}

/* EMOJI PICKER & REAÇÕES */
.emoji-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.emoji-picker {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  width: 320px;
  background: rgba(18, 18, 22, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
  z-index: 1000;
  user-select: none;
  flex-direction: column;
  animation: emojiPickerFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.emoji-picker::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 0;
  right: 0;
  height: 14px;
  background: transparent;
}

.emoji-container:hover .emoji-picker,
.emoji-picker.show {
  display: flex !important;
}

.emoji-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.emoji-tabs::-webkit-scrollbar {
  display: none;
}

.emoji-tab-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  cursor: pointer;
  padding: 5px 3px;
  border-radius: 6px;
  opacity: 0.55;
  transition: all 0.15s ease;
  flex: 1;
  text-align: center;
}

.emoji-tab-btn:hover,
.emoji-tab-btn.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.15);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.emoji-grid::-webkit-scrollbar {
  width: 5px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.emoji-item {
  font-size: 22px;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif !important;
  cursor: pointer;
  text-align: center;
  padding: 6px 2px;
  border-radius: 6px;
  transition: transform 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.25);
}

.quick-reaction-bar {
  user-select: none;
  background: rgba(255, 255, 255, 0.04);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.q-react-btn {
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease;
  user-select: none;
}

.q-react-btn img,
.q-react-btn .emoji-svg {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
}

.q-react-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px) scale(1.3);
}

.q-react-btn:active {
  transform: scale(0.9);
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 12px;
  padding: 3px 9px;
  height: 26px;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: reactionPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) ease-out;
}

.reaction-pill:hover {
  transform: translateY(-1.5px) scale(1.06);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.reaction-pill:active {
  transform: scale(0.95);
}

.reaction-pill.active {
  background: linear-gradient(135deg, rgba(212, 160, 170, 0.28), rgba(212, 160, 170, 0.14)) !important;
  border: 1px solid var(--petal-color) !important;
  box-shadow: 0 0 10px rgba(212, 160, 170, 0.35) !important;
}

.reaction-pill .pill-emoji-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.reaction-pill .pill-emoji-wrapper img,
.reaction-pill .pill-emoji-wrapper .emoji-svg {
  width: 15px;
  height: 15px;
  object-fit: contain;
  display: block;
}

.reaction-pill .pill-count {
  font-weight: 600;
  font-size: 11px;
  line-height: 1;
  font-family: 'Montserrat', sans-serif;
  color: var(--text-color);
  letter-spacing: 0.2px;
}

.reaction-pill.active .pill-count {
  color: var(--petal-color) !important;
  font-weight: 700;
}

.msg-status-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  margin-left: 4px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.msg-status-icon.sent {
  opacity: 0.55;
  color: rgba(255, 255, 255, 0.55);
}

.msg-status-icon.read {
  opacity: 1;
  color: #00d2ff;
  filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.65));
  animation: status-read-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* UNIFORMIZAÇÃO DE FONTE CHAT NO COURIER NEW */
#page-chat,
#page-chat *,
.chat-layout-whatsapp,
.chat-layout-whatsapp *,
.chat-container-fullscreen,
.chat-container-fullscreen *,
.chat-main,
.chat-main *,
.chat-sidebar,
.chat-sidebar *,
.chat-right-panel,
.chat-right-panel *,
.emoji-picker,
.emoji-picker * {
  font-family: 'Courier New', Courier, monospace, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !important;
}

/* SELEÇÃO EM MASSA E DRAG SELECTION */
body.chat-drag-active,
body.chat-drag-active * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

#chatMsgs {
  position: relative;
}

.chat-drag-selection-box {
  position: absolute;
  pointer-events: none;
  z-index: 999;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 0 !important;
}

.msg-select-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.85);
  transition: all 0.2s ease;
  color: transparent;
  align-self: center;
  flex-shrink: 0;
  margin: 0 6px;
  user-select: none;
}

.msg.selected .msg-select-check {
  opacity: 1;
  transform: scale(1);
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-color);
  color: var(--text-color);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.msg.selected {
  z-index: 10;
}

.msg.selected .msg-bubble {
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4), inset 0 0 8px rgba(255, 255, 255, 0.04) !important;
}

[data-theme="light"] .msg.selected .msg-bubble {
  border-color: rgba(0, 0, 0, 0.35) !important;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.1) !important;
}

.chat-bulk-toolbar {
  position: absolute !important;
  top: 65px !important;
  bottom: auto !important;
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
  height: 46px !important;
  min-height: 46px !important;
  max-height: 46px !important;
  width: 100% !important;
  max-width: 100% !important;
  z-index: 120 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
  background: rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: none !important;
  border-bottom: 1px solid var(--glass-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  animation: bulkSlideDownSub 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  user-select: none !important;
}

[data-theme="light"] .chat-bulk-toolbar {
  background: rgba(255, 255, 255, 0.5) !important;
}

@keyframes bulkSlideDownSub {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bulk-toolbar .bulk-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-bulk-toolbar .bulk-close-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-bulk-toolbar .bulk-close-btn:hover {
  background: var(--glass-hover);
  color: var(--text-color);
  border-color: var(--text-muted);
}

.chat-bulk-toolbar .bulk-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Courier New', Courier, monospace !important;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.chat-bulk-toolbar .bulk-count-highlight {
  color: var(--text-color);
  font-weight: 700;
}

.chat-bulk-toolbar .bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-bulk-toolbar .bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-color);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'Courier New', Courier, monospace !important;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-bulk-toolbar .bulk-btn:hover {
  background: var(--glass-hover);
  border-color: var(--text-muted);
}

.chat-bulk-toolbar .bulk-btn.delete {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  color: #f87171;
}

.chat-bulk-toolbar .bulk-btn.delete:hover {
  background: rgba(220, 38, 38, 0.3);
  border-color: rgba(220, 38, 38, 0.7);
  color: #ffffff;
}

@media (max-width: 900px) {
  .chat-layout-whatsapp {
    grid-template-columns: 320px 1fr !important;
  }

  .chat-layout-whatsapp.show-right-panel {
    grid-template-columns: 320px 1fr !important;
  }

  .chat-sidebar {
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
  }

  .chat-right-panel {
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
  }
}

/* ============================================================
   FLUXO MOBILE DO CHAT (2 TELAS: LISTA DE SALAS ↔ CONVERSA ATIVA)
   ============================================================ */
.chat-mobile-back-btn {
  display: none !important;
}

@media (max-width: 768px) {
  .chat-container-fullscreen {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .chat-layout-whatsapp {
    display: flex !important;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  /* TELA 1 (Lista): exibe barra de pastas e canais */
  .chat-folder-bar {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    flex-shrink: 0;
  }

  .chat-sidebar {
    flex: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  .chat-main {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    inset: 0;
    z-index: 50;
    background: #18181b;
  }

  /* TELA 2 (Conversa Ativa): oculta listas e exibe a conversa */
  .chat-layout-whatsapp.conversation-active .chat-folder-bar,
  .chat-layout-whatsapp.conversation-active .chat-sidebar {
    display: none !important;
  }

  .chat-layout-whatsapp.conversation-active .chat-main {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Oculta engrenagem flutuante no chat mobile (tanto na tela inicial de contatos quanto durante conversa ativa) */
  body:has(.chat-layout-whatsapp) .settings-fab,
  body:has(#page-chat) .settings-fab {
    display: none !important;
  }

  /* ============================================================
  // TOPBAR DO CHAT NO MOBILE (ALINHAMENTO À ESQUERDA PADRÃO WHATSAPP)
  // ============================================================ */
  .chat-topbar {
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    padding: 8px 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
  }

  .chat-mobile-back-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: var(--petal-color, #ffb6c1) !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    transition: background 0.2s, border-color 0.2s !important;
  }

  .chat-mobile-back-btn:active {
    background: rgba(255, 255, 255, 0.12) !important;
  }

  .chat-ch-info {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    cursor: pointer !important;
  }

  .chat-ch-info > div:last-child {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  .chat-ch-avatar,
  #mainAvatar {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }

  .chat-ch-name {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--text-color, #f8fafc) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-bottom: 2px !important;
    line-height: 1.2 !important;
  }

  .chat-online {
    font-size: 11.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
    gap: 5px !important;
  }

  .online-dot {
    width: 7px !important;
    height: 7px !important;
    flex-shrink: 0 !important;
  }

  .chat-actions {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  /* ============================================================
     BOLHAS DE CHAT NO MOBILE (LARGURA FLUIDA & PROPORÇÃO NATURAL)
     ============================================================ */
  .messages {
    padding: 12px 10px !important;
    gap: 12px !important;
  }

  .msg {
    max-width: 86% !important;
    gap: 8px !important;
    align-items: flex-end !important;
  }

  .msg-av {
    width: 32px !important;
    height: 32px !important;
    font-size: 11px !important;
    margin-bottom: 2px !important;
    flex-shrink: 0 !important;
  }

  .msg-content-wrapper {
    max-width: calc(100% - 40px) !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .msg-bubble {
    padding: 8px 12px !important;
    font-size: 14.5px !important;
    line-height: 1.45 !important;
    max-width: 100% !important;
    width: fit-content !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  .msg-sender-name {
    font-size: 11.5px !important;
    gap: 4px !important;
    margin-bottom: 3px !important;
  }

  .msg-time-wrapper {
    margin-left: 8px !important;
  }

  .msg-time {
    font-size: 9.5px !important;
  }

  .input-row {
    padding: 8px 12px !important;
    position: sticky;
    bottom: 0;
    background: rgba(18, 18, 22, 0.95);
    backdrop-filter: blur(12px);
  }

  .input-wrapper {
    min-height: 40px !important;
  }

  .chat-right-panel {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
  }
}