/* ==========================================================================
   ITECBRASIL Bot de Atendimento - CSS V10 (Balão de Mensagem sobre a Bolha)
   ========================================================================== */

#itec-chat-widget {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 9999999 !important;
  direction: ltr !important;
  pointer-events: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

#itec-chat-widget * {
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  font-family: inherit !important;
  line-height: 1.5 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

/* Balão de Mensagem de Boas-Vindas sobre o Ícone Flutuante */
#itec-chat-widget .itec-trigger-tooltip {
  pointer-events: auto !important;
  position: absolute !important;
  bottom: 78px !important;
  right: 0 !important;
  background: #ffffff !important;
  color: #004b93 !important;
  padding: 10px 16px !important;
  border-radius: 16px !important;
  border-bottom-right-radius: 4px !important;
  box-shadow: 0 10px 25px rgba(0, 75, 147, 0.25) !important;
  border: 2px solid #004b93 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  z-index: 99 !important;
  animation: itecFloatBounce 3s ease-in-out infinite !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
}

#itec-chat-widget.active .itec-trigger-tooltip {
  display: none !important;
}

#itec-chat-widget .itec-tooltip-text {
  line-height: 1.3 !important;
}

#itec-chat-widget .itec-tooltip-text span {
  display: block !important;
  font-size: 11px !important;
  color: #64748b !important;
  font-weight: 500 !important;
}

#itec-chat-widget .itec-tooltip-close {
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 16px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  line-height: 1 !important;
  padding: 2px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#itec-chat-widget .itec-tooltip-close:hover {
  color: #ef4444 !important;
}

@keyframes itecFloatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Botão Flutuante (Trigger) */
#itec-chat-widget .itec-chat-trigger {
  pointer-events: auto !important;
  width: 64px !important;
  height: 64px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #004b93, #0066c7) !important;
  border: 3px solid #ffffff !important;
  cursor: pointer !important;
  box-shadow: 0 10px 25px rgba(0, 75, 147, 0.4) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  outline: none !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

#itec-chat-widget .itec-chat-trigger:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 14px 30px rgba(0, 75, 147, 0.5) !important;
}

#itec-chat-widget .itec-trigger-avatar {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: top center !important;
  background-color: #ffffff !important;
  display: block !important;
  border: none !important;
}

#itec-chat-widget .itec-trigger-badge {
  position: absolute !important;
  top: -2px !important;
  right: -2px !important;
  background-color: #ff6b35 !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 2px solid #ffffff !important;
  z-index: 3 !important;
}

/* Janela Principal do Chat */
#itec-chat-widget .itec-chat-box {
  pointer-events: auto !important;
  position: absolute !important;
  bottom: 80px !important;
  right: 0 !important;
  width: 370px !important;
  max-width: calc(100vw - 32px) !important;
  height: 550px !important;
  max-height: calc(100vh - 110px) !important;
  background: #ffffff !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 40px rgba(0, 38, 77, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(20px) scale(0.95) !important;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s !important;
  border: 1px solid #cbd5e1 !important;
}

#itec-chat-widget.active .itec-chat-box {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
}

/* Cabeçalho */
#itec-chat-widget .itec-chat-header {
  background: linear-gradient(135deg, #002d5a 0%, #004b93 100%) !important;
  color: #ffffff !important;
  padding: 14px 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15) !important;
  position: relative !important;
  z-index: 20 !important;
  height: 68px !important;
  flex-shrink: 0 !important;
}

#itec-chat-widget .itec-header-info {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

#itec-chat-widget .itec-avatar-wrapper {
  position: relative !important;
  width: 44px !important;
  height: 44px !important;
  flex-shrink: 0 !important;
}

#itec-chat-widget .itec-header-avatar {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: top center !important;
  background: #ffffff !important;
  border: 2px solid #ffffff !important;
  display: block !important;
}

#itec-chat-widget .itec-status-dot-overlay {
  position: absolute !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 12px !important;
  height: 12px !important;
  background-color: #10b981 !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
}

#itec-chat-widget .itec-header-text {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

#itec-chat-widget .itec-header-title {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  line-height: 1.2 !important;
}

#itec-chat-widget .itec-header-subtitle {
  font-size: 11.5px !important;
  color: rgba(255, 255, 255, 0.88) !important;
  margin-top: 2px !important;
}

#itec-chat-widget .itec-close-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  border: none !important;
  color: #ffffff !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s ease !important;
}

#itec-chat-widget .itec-close-btn:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* Modal de Lead (Nome & CPF) */
#itec-chat-widget .itec-lead-modal {
  position: absolute !important;
  top: 68px !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: #ffffff !important;
  z-index: 30 !important;
  padding: 24px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 16px !important;
}

#itec-chat-widget .itec-lead-modal.itec-hidden {
  display: none !important;
}

#itec-chat-widget .itec-lead-avatar {
  width: 76px !important;
  height: 76px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: top center !important;
  border: 3px solid #004b93 !important;
  box-shadow: 0 6px 16px rgba(0, 75, 147, 0.25) !important;
}

#itec-chat-widget .itec-lead-title {
  font-size: 17px !important;
  font-weight: 800 !important;
  color: #004b93 !important;
}

#itec-chat-widget .itec-lead-desc {
  font-size: 13px !important;
  color: #64748b !important;
  line-height: 1.4 !important;
  margin-top: -6px !important;
}

#itec-chat-widget .itec-lead-form {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  margin-top: 6px !important;
}

#itec-chat-widget .itec-lead-input {
  width: 100% !important;
  height: 44px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  outline: none !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  transition: all 0.2s ease !important;
}

#itec-chat-widget .itec-lead-input:focus {
  border-color: #004b93 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.12) !important;
}

#itec-chat-widget .itec-lead-submit {
  width: 100% !important;
  height: 46px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #004b93, #0066c7) !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(0, 75, 147, 0.3) !important;
  transition: transform 0.2s ease !important;
  margin-top: 4px !important;
}

/* Área de Mensagens */
#itec-chat-widget .itec-chat-messages {
  flex: 1 !important;
  padding: 16px !important;
  overflow-y: auto !important;
  background-color: #f4f7fa !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  position: relative !important;
  z-index: 5 !important;
}

/* Scrollbar */
#itec-chat-widget .itec-chat-messages::-webkit-scrollbar {
  width: 5px !important;
}
#itec-chat-widget .itec-chat-messages::-webkit-scrollbar-track {
  background: transparent !important;
}
#itec-chat-widget .itec-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 10px !important;
}

/* Mensagens */
#itec-chat-widget .itec-message {
  display: flex !important;
  gap: 10px !important;
  width: 100% !important;
  position: relative !important;
}

#itec-chat-widget .itec-message.bot {
  align-self: flex-start !important;
}

#itec-chat-widget .itec-message.user {
  align-self: flex-end !important;
  justify-content: flex-end !important;
}

#itec-chat-widget .itec-msg-avatar {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: top center !important;
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
  background: #ffffff !important;
  flex-shrink: 0 !important;
  margin-top: 2px !important;
}

#itec-chat-widget .itec-message-content {
  display: flex !important;
  flex-direction: column !important;
  max-width: 88% !important;
}

#itec-chat-widget .itec-message-bubble {
  padding: 12px 16px !important;
  border-radius: 16px !important;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
}

#itec-chat-widget .itec-message.bot .itec-message-bubble {
  background: #ffffff !important;
  color: #0f172a !important;
  border-top-left-radius: 4px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  border: 1px solid #e2e8f0 !important;
}

#itec-chat-widget .itec-message.user .itec-message-bubble {
  background: #004b93 !important;
  color: #ffffff !important;
  border-top-right-radius: 4px !important;
  box-shadow: 0 3px 8px rgba(0, 75, 147, 0.2) !important;
}

#itec-chat-widget .itec-message-time {
  font-size: 10px !important;
  color: #94a3b8 !important;
  margin-top: 4px !important;
  font-weight: 500 !important;
}

#itec-chat-widget .itec-message.bot .itec-message-time { align-self: flex-start !important; }
#itec-chat-widget .itec-message.user .itec-message-time { align-self: flex-end !important; }

/* Links e Botão WhatsApp */
#itec-chat-widget .itec-chat-link {
  color: #004b93 !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
}

#itec-chat-widget .itec-wa-direct-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  background-color: #25d366 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 13.5px !important;
  padding: 10px 18px !important;
  border-radius: 25px !important;
  text-decoration: none !important;
  margin-top: 10px !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3) !important;
  transition: transform 0.2s ease, background 0.2s ease !important;
}

#itec-chat-widget .itec-wa-direct-link:hover {
  background-color: #1eb956 !important;
  transform: translateY(-2px) !important;
}

/* Indicador de Digitação */
#itec-chat-widget .itec-typing {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 12px 18px !important;
  background: #ffffff !important;
  border-radius: 16px !important;
  border-top-left-radius: 4px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  border: 1px solid #e2e8f0 !important;
}

#itec-chat-widget .itec-typing span {
  width: 7px !important;
  height: 7px !important;
  background-color: #004b93 !important;
  border-radius: 50% !important;
  animation: typingBounce 1.4s infinite ease-in-out both !important;
}

#itec-chat-widget .itec-typing span:nth-child(1) { animation-delay: -0.32s !important; }
#itec-chat-widget .itec-typing span:nth-child(2) { animation-delay: -0.16s !important; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Área de Entrada de Texto */
#itec-chat-widget .itec-chat-footer {
  padding: 10px 14px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  height: 62px !important;
  flex-shrink: 0 !important;
  position: relative !important;
  z-index: 10 !important;
}

#itec-chat-widget .itec-chat-input {
  flex: 1 !important;
  height: 42px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 21px !important;
  padding: 0 16px !important;
  font-size: 13.5px !important;
  outline: none !important;
  background-color: #f8fafc !important;
  color: #0f172a !important;
  box-shadow: none !important;
}

#itec-chat-widget .itec-chat-input:focus {
  border-color: #004b93 !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.12) !important;
}

#itec-chat-widget .itec-send-btn {
  background: #004b93 !important;
  color: #ffffff !important;
  border: none !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-shadow: 0 3px 8px rgba(0, 75, 147, 0.3) !important;
}

#itec-chat-widget .itec-send-btn svg {
  width: 17px !important;
  height: 17px !important;
  fill: #ffffff !important;
  margin-left: 2px !important;
}

/* Rodapé Institucional */
#itec-chat-widget .itec-branding {
  text-align: center !important;
  font-size: 10.5px !important;
  color: #64748b !important;
  padding: 4px 0 6px !important;
  background: #ffffff !important;
  font-weight: 700 !important;
  border-top: 1px solid #f1f5f9 !important;
  flex-shrink: 0 !important;
}

/* Responsividade Mobile */
@media (max-width: 480px) {
  #itec-chat-widget {
    bottom: 16px !important;
    right: 16px !important;
  }
  #itec-chat-widget .itec-chat-box {
    bottom: 74px !important;
    right: 0 !important;
    width: calc(100vw - 32px) !important;
    height: calc(100vh - 100px) !important;
  }
  #itec-chat-widget .itec-trigger-tooltip {
    font-size: 12px !important;
    padding: 8px 12px !important;
  }
}
