/* ==========================================================================
   RookGo Chat - Estilos Isolados e Blindados contra Conflitos Globais
   ========================================================================== */

#rookgo-global-actions {
  all: initial;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

#rookgo-global-actions *, 
#rookgo-global-actions *::before, 
#rookgo-global-actions *::after {
  box-sizing: border-box;
  font-family: inherit;
}

/* Botões Flutuantes (WhatsApp e IA) */
#rookgo-global-actions .rg-float {
  position: fixed;
  z-index: 999999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
  background: none;
  margin: 0;
  width: auto;
  height: auto;
}

#rookgo-global-actions .rg-float:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

/* Posicionamento dos Botões Flutuantes (IA em cima do WhatsApp) */
#rookgo-global-actions #rg-ai-launch {
  right: 24px;
  bottom: 84px;
  background-color: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#rookgo-global-actions #rg-wa-launch {
  right: 24px;
  bottom: 24px;
  background-color: #25d366;
  color: #0b2212;
}

#rookgo-global-actions .rg-float-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

#rookgo-global-actions .rg-float-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Painel da IA (Janela de Chat com Sombra Forte e Imponente) */
#rookgo-global-actions #rg-ai-panel {
  position: fixed;
  bottom: 140px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 160px);
  background-color: #101827;
  color: #f3f6fb;
  border-radius: 20px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  z-index: 1000000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#rookgo-global-actions #rg-ai-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Cabeçalho do Chat */
#rookgo-global-actions #rg-ai-head {
  padding: 14px 18px;
  background-color: rgba(12, 18, 30, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#rookgo-global-actions #rg-ai-head strong {
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
  display: block;
}

#rookgo-global-actions #rg-ai-status {
  font-size: 0.7rem;
  color: #8b9bb0;
  font-weight: 600;
  margin-top: 1px;
}

/* Botão Fechar Exclusivo do Chat */
#rookgo-global-actions #rg-ai-close {
  all: unset;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #8b9bb0;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s;
}

#rookgo-global-actions #rg-ai-close:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

#rookgo-global-actions #rg-ai-close svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Área de Mensagens */
#rookgo-global-actions #rg-ai-messages {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Mensagem de Boas-vindas */
#rookgo-global-actions .rg-ai-welcome {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  margin-top: -15px;
  padding: 0 4px;
}

/* Título de Boas-Vindas com a Fonte Exata */
#rookgo-global-actions .rg-ai-welcome h4 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0;
  line-height: 1.35;
}

#rookgo-global-actions .rg-ai-chips-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* Botões de Sugestão (Chips) SEM NEGRITO */
#rookgo-global-actions .rg-ai-chip {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 400 !important;
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

#rookgo-global-actions .rg-ai-chip:hover {
  border-color: #2dd4bf !important;
  background: rgba(45, 212, 191, 0.1) !important;
  color: #2dd4bf !important;
  transform: translateY(-1px);
}

/* Indicador de Digitação */
#rookgo-global-actions #rg-ai-typing {
  display: none;
  padding: 0 18px 8px 18px;
  font-size: 0.75rem;
  color: #8b9bb0;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Rodapé / Input de Envio */
#rookgo-global-actions #rg-ai-compose {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: #0b111c;
  flex-shrink: 0;
}

#rookgo-global-actions #rg-ai-input-wrap {
  background: #0b111c;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#rookgo-global-actions #rg-ai-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #f3f6fb;
  font-size: 0.85rem;
  resize: none;
  max-height: 80px;
  outline: none;
  line-height: 1.4;
}

#rookgo-global-actions #rg-ai-compose-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.7rem;
  color: #8b9bb0;
  font-weight: 600;
}

/* Botão Enviar com Verde VÍVIDO e VIBRANTE */
#rookgo-global-actions #rg-ai-send {
  all: unset;
  box-sizing: border-box;
  background-color: #34d399 !important;
  color: #022c22 !important;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(52, 211, 153, 0.35);
  transition: opacity 0.2s, transform 0.2s, background-color 0.2s;
}

#rookgo-global-actions #rg-ai-send:hover {
  background-color: #10b981 !important;
  transform: translateY(-1px);
}

#rookgo-global-actions #rg-ai-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Responsividade Mobile */
@media (max-width: 480px) {
  #rookgo-global-actions #rg-ai-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #rookgo-global-actions #rg-ai-launch {
    right: 24px;
    bottom: 84px;
  }
}