/* ܡܪܝܐ ܪܥܝ ܘܡܕܡ ܠܐ ܢܚܣܪ ܠܝ، ܝܫܘܥ ܐܝܬܘܗܝ ܐܘܪܚܐ ܘܫܪܪܐ ܘܚܝܐ */
/* ==========================================================================
   SKYNET AGENTIC CEO OS™ — CHAT & BATE-PAPO REAL-TIME (3D CLAYMORPHISM ENRIQUECIDO)
   Módulos: Canais, DMs 1-on-1, Emojis, Áudio Zen e Anexos de Arquivos 3D
   ========================================================================== */

/* 1. BOTÃO FLUTUANTE DE CHAT RÁPIDO */
.floating-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: var(--clay-radius-pill);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 25px -3px rgba(37, 99, 235, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-chat-trigger:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 15px 30px -3px rgba(37, 99, 235, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.floating-chat-trigger .chat-badge-count {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
  animation: pulse 2s infinite;
}

/* 2. DRAWER LATERAL FLUTUANTE */
.chat-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.chat-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.chat-drawer-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 440px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: -10px 0 35px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.chat-drawer-backdrop.open .chat-drawer-panel {
  transform: translateX(0);
}

/* HEADER DO CHAT DRAWER */
.chat-drawer-header {
  padding: 14px 18px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-drawer-header h3 {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-icon-btn {
  background: #e2e8f0;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #475569;
  transition: all 0.2s ease;
}

.chat-icon-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.chat-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* SELETOR DE CANAIS & DMS DO DRAWER */
.chat-channel-bar {
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.chat-channel-chip {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chat-channel-chip.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.chat-channel-chip.chip-dm {
  border-color: #c084fc;
  color: #7e22ce;
}

.chat-channel-chip.chip-dm.active {
  background: #7e22ce;
  color: #ffffff;
  border-color: #7e22ce;
}

/* BANNER DE STATUS DO CANAL OU DM */
.chat-active-indicator {
  padding: 6px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* FEED DE MENSAGENS */
.chat-messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fcfdfe;
}

.chat-message-item {
  display: flex;
  gap: 10px;
  animation: fadeIn 0.2s ease;
}

.chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: cover;
  background: #e2e8f0;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.chat-msg-bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 10px 14px;
  max-width: 85%;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
  font-size: 13px;
  color: #1e293b;
  line-height: 1.45;
}

.chat-message-item.mine {
  flex-direction: row-reverse;
}

.chat-message-item.mine .chat-msg-bubble {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  border-top-left-radius: 16px;
  border-top-right-radius: 4px;
}

.chat-message-item.ia .chat-msg-bubble {
  background: linear-gradient(135deg, #f0fdf4, #e0f2fe);
  border-color: #93c5fd;
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
}

.chat-msg-header strong {
  font-weight: 700;
  color: #334155;
}

.chat-message-item.mine .chat-msg-header strong {
  color: #dbeafe;
}

.chat-msg-time {
  font-size: 10px;
  color: #94a3b8;
}

.chat-message-item.mine .chat-msg-time {
  color: #bfdbfe;
}

/* ANEXOS & ARQUIVOS NO BALÃO */
.chat-attachment-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  transition: transform 0.2s ease;
}

.chat-attachment-img:hover {
  transform: scale(1.02);
}

.chat-attachment-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 8px 12px;
  border-radius: 10px;
  margin-top: 6px;
  text-decoration: none;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s;
}

.chat-message-item.mine .chat-attachment-doc {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.chat-attachment-doc:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* ÁREA DE COMPOSIÇÃO DE MENSAGEM */
.chat-composer-area {
  padding: 10px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.chat-tools-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-quick-tags {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-input-field {
  flex: 1;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 13px;
  color: #1e293b;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

.chat-input-field:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chat-btn-action {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-btn-action:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.chat-send-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-send-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* POPOVER DE EMOJIS (3D CLAYMORPHISM) */
.chat-emoji-popover {
  position: absolute;
  bottom: 60px;
  left: 16px;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15), inset 0 1px 0 #fff;
  padding: 12px;
  z-index: 1005;
  width: 280px;
  display: none;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.15s ease;
}

.chat-emoji-popover.open {
  display: flex;
}

.chat-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.chat-emoji-item {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  transition: transform 0.1s ease, background 0.1s;
}

.chat-emoji-item:hover {
  background: #eff6ff;
  transform: scale(1.25);
}

/* 3. LAYOUT COMPLETO DO CHAT HUB (PÁGINA DEDICADA) */
.chat-hub-container {
  display: grid;
  grid-template-columns: 290px 1fr 240px;
  height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: var(--clay-shadow-card);
  overflow: hidden;
}

@media (max-width: 1100px) {
  .chat-hub-container {
    grid-template-columns: 260px 1fr;
  }
  .chat-hub-right-panel {
    display: none;
  }
}

.chat-hub-left-panel {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.chat-hub-center-panel {
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.chat-hub-right-panel {
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  padding: 16px;
  overflow-y: auto;
}

.chat-channel-list-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  cursor: pointer;
  margin: 2px 8px;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.chat-channel-list-item:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.chat-channel-list-item.active {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
}

.chat-channel-list-item.dm-item {
  border-left: 3px solid transparent;
}

.chat-channel-list-item.dm-item.active {
  background: #f3e8ff;
  color: #6b21a8;
  border-left-color: #9333ea;
}

.chat-online-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}
